I've got a fairly large VS2008/MFC application that has been around for quite some time. The program has functionality to have sounds played (using PlaySound) when certain events occur. It's seldom used and frankly I rarely test anything to do with it. So, I didn't notice that at some point the PlaySound quit working with Windows 7. I can take a current version of the program and it works fine on Windows XP, but nothing happens on Windows 7. I can get small sample apps to work ok in W7 using the same WAV files so I know this not related to the WAV file itself.
The code is basically this:
PlaySound(_T("C:\\Windows\Media\\Tada.wav"), NULL, SND_FILENAME | SND_ASYNC );
What I've done so far is:
1) Tried different combinations of the SND_* constants.
2) Tried creating another thread and executing it there using SND_SYNC
3) Tried removing as many dependencies on outside libraries as possible.
4) Tried playing WAV files that come with Windows, Aliases. Nothing works in this application, but does in test applications.
As I said, I can create test apps that work ok. If I play the sound using SND_SYNC, it fails but you can't use GetLastError() to find out why. Using SND_ASYNC will cause PlaySound to always return
true, but no sound comes out. I'm really at a loss with this. Clearly there's something I'm doing to cause the problem but at this point I don't know how to troubleshoot this any further. Does anyone have any idea what I could do to cause this to occur?