Windows – Enumerate all Vista/7 audio “sessions”, as displayed in the Volume Mixer

windows 7windows-vista

In windows Vista & 7*, how would you enumerate the programs which are currently playing audio (or trying to, in the event master volume is muted)? Essentially, I need the data displayed in the Volume Mixer found in the notification area.

Master volume is pretty easy:
ISimpleAudioVolume::GetMasterVolume()
http://msdn.microsoft.com/en-us/library/ms679156(VS.85).aspx

But nothing about particular programs is forthcoming.

*Obviously the target is Vista, but I see no reason a solution wouldn't also work in 7.

Language is irrelevant, though C# would be appreciated.

Best Answer

Fortunately your answer is incorrect. Check out the IAudioSessionManager2 interface - the RegisterSessionNotification API is your friend.