Search code examples
c#winforms.net-2.0

How to mute the application in Win XP?


Currently, I am using the following code to mute my application:

[DllImport("winmm.dll")]
public static extern int waveOutSetVolume(IntPtr h, uint dwVolume);

private void mute()
{
    waveOutSetVolume(IntPtr.Zero, 0);
}

In Windows 7 it works but in windows XP it mutes the entire system and not only the application. How can I mute only the application in windows XP?

The WebBrowser control is the one generating the sound in my application (for example, if it plays a video).


Solution

  • Shamelessly posting an answer stolen from Thomas Levensque's comment:

    The ability to change the volume on a per-application basis was new in Win7, IIRC, so it's not possible to do it in WinXP