Find current application that is playing audio.

Aug 19, 2013 at 10:08pm
Is it possible to find out what application is currently playing audio. Also I would like to get a HWND handle to the window. Is there some way or trick you can do this in windows? Also the code does not have to be in c++ it can my any other lang too.

If possible would like some example code. Thanks.
Last edited on Aug 19, 2013 at 10:24pm
Aug 19, 2013 at 10:13pm
I'm almost sure it is possible, because of the Volume Control application in Windows 7.
It is an application on its own.
But I cannot help you further.
I think you should look into winmm.h anyways.
Aug 19, 2013 at 10:24pm
ok thx though.
Aug 19, 2013 at 10:31pm
For Windows 7 (and Windows 8, I expect), you can obtains IAudioSessionEnumerator via IAudioSessionManager2::GetSessionEnumerator.

IAudioSessionEnumerator interface
http://msdn.microsoft.com/en-us/library/windows/desktop/dd368281%28v=vs.85%29.aspx

Etc.

These interfaces are part of the Core Audio API, not the (legacy) Windows Multimedia API

Andy
Aug 20, 2013 at 3:26am
Looks complicated. Anyone find anything else?
Aug 20, 2013 at 4:53am
closed account (G309216C)
Hi Manvir,

Try to gain process handle to sound player such as RealTk and such then hook functions part of Audio API then get the process name of the Audio playing processes and process that data via reading back the returns and such.

Hooking is a fantastic tool to debug and learn about the information during run-time, not sure if my idea will work because I have not tried it yet but pretty sure it is quite straight-forward.
To be honest, Andy's solution is much more effective and simpler than mine. It may be complicated but there are some complicated topics in programming.

GL
Topic archived. No new replies allowed.