I'm trying to play music from within a DLL. However, whenever I try this, the PlaySound function does nothing.
I've already attempted having the wav file in a resource and I know that the code works as when I compile the DLLMain as a normal main, it plays the music with no problems. The DLLMain code looks like this:
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
PlaySoundA("C:\\Sound.wav", NULL, SND_FILENAME);
}
return TRUE;
The strange thing is, I can see that the song is in the program's memory; the memory usage of it goes up to what it should do when it plays a song, but it has no sound. Also, the same code compiled to an exe works perfectly; I can't figure out what's going wrong.
UPDATE: It turns out this is because you can't execute lots of things in DLLMain - are there any ways around this?