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.
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.