Hello! I have a problem regarding playing sound from a resource file. Of course, I could just include the sound files in the installation, but that would be too much of a hassle. So, I made this:
It gets a handle to the program, and then plays the sound "spooky.wav". At least it should.... It compiles fine, no warnings, but no sound plays. I would like to know what I'm doing wrong. Oh, and btw: the compiler shows no errors, but does show this for the output:
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
First-chance exception at 0x77b1f697 in Application.exe: 0xC0000005: Access violation reading location 0xfffffffc.
The program '[4220] Application.exe: Native' has exited with code 0 (0x0).
The .rc file should be in the same folder as the .cpp file.
It probably depends which compiler and IDE you use. I just created a new project and added the .cpp and .rc files to it. The wav files will I suppose be found according to the file/pathname.
Well, I figured it out. However, it always says "'IDR_WAVE1': undeclared identifier"
Also, I was wondering, my version of Visual Studio is from 2008. Could that be it? That it's simply outdated?
Output from step 2 is file sounds.res, size is 8547 kb. This large file contains the wave data. (In this case it is almost the same size as the sound file spooky.wav).