Find current application that is playing audio.

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
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.
ok thx though.
For Windows 7 (and Windows 8, I expect), you can obtains IAudioSessionEnumerator via IAudioSessionManager2::GetSessionEnumerator.

IAudioSessionEnumerator interface


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

Looks complicated. Anyone find anything else?
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.

Topic archived. No new replies allowed.