I'm trying to unmute the volume from a console app using the standard SendMessageW()
method. However, we have our own application running as the shell, instead of explorer.exe. When I try to unmute, nothing happens; but as soon as I start Explorer it works fine. Does explorer have to be running for messages to be sent?
Code:
private const int APPCOMMAND_VOLUME_MUTE = 0x80000;
private const int WM_APPCOMMAND = 0x319;
SendMessageW(Process.GetCurrentProcess().MainWindowHandle, WM_APPCOMMAND, Process.GetCurrentProcess().MainWindowHandle, (IntPtr)APPCOMMAND_VOLUME_MUTE);
Return value from SendMessageW()
is 0.
If Explorer is needed, does anybody know of an alternate method of unmuting?
Side Note
I just tried it using vbs:
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys(chr(&hAD))
And got the same results. It only unmutes if explorer.exe is running.