Mute/disable all sounds on Active X GUI? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Cuadrix
Posts: 236
Joined: 07 May 2017, 08:26

Mute/disable all sounds on Active X GUI?

18 Mar 2018, 01:21

Would it be possible to disable all sounds in an Active X GUI without it affecting the systems sound level?
I have searched both the old and the current forum(s), and it looks like a have hit hard wall...

Something like this:
Gui, Add, ActiveX, h400 w600 DISABLE SOUND vWB, Shell.Explorer
Or maybe a DLL call is necessary?

It'd be nice if someone would point me to the right direction.
Guest

Re: Mute/disable all sounds on Active X GUI?  Topic is solved

18 Mar 2018, 17:46

You can prevent audioses.dll's COM interfaces from being instantiated. But this will disable all sounds throughout your AutoHotkey script, not just those created by the ActiveX object.

Code: Select all

ComFail(rclsid, riid, ppv) {
	if (ppv)
	{
		NumPut(ppv+0, "ptr")
	}
	return 0x8007000E
}

FuncHook(hModule, ProcName, JumpTarget) {
	static code := 0
	if (!code)
	{
		if (A_PtrSize == 8)
			code := [ 0x48, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE0 ]
		else
			code := [ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE0 ]
	}
	
	func := DllCall("GetProcAddress", "ptr", hModule, "astr", ProcName, "ptr")

	if (!func)
		return

	VarSetCapacity(buf, code.Length())
	for i, b in code
		NumPut(b, buf, i-1, "uchar")

	if (A_PtrSize == 8)
	{
		NumPut(JumpTarget, buf, 2, "int64")
	}
	else
	{
		NumPut(JumpTarget, buf, 1, "int")
	}

	DllCall("VirtualProtect", "ptr", func, "ptr", code.Length(), "uint", 0x40, "uint*", OldProtect)
	DllCall("ntdll\RtlMoveMemory", "ptr", func, "ptr", &buf, "ptr", code.Length())
	DllCall("VirtualProtect", "ptr", func, "ptr", code.Length(), "uint", OldProtect, "uint*", OldProtect)
}

FuncHook(DllCall("LoadLibrary", "str", "audioses.dll", "ptr"), "DllGetClassObject", RegisterCallback("ComFail", "f"))

Gui, Add, ActiveX, h480 w640 vWB, Shell.Explorer
WB.Navigate("https://youtube.com/watch?v=something")
Gui Show
User avatar
Cuadrix
Posts: 236
Joined: 07 May 2017, 08:26

Re: Mute/disable all sounds on Active X GUI?

18 Mar 2018, 18:30

I don't really mind disabling the sounds from my script all together, so this should do the job for now.
Thank you.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 319 guests