I am trying to load a .wav file using a .rc file, and play it using the play sound function, but when the program calls for the sound to be played, I get an error saying that the program stopped working. here is my code
Code:#include "Resource.h" //Icon IDI_DUCKHUNT ICON "Res\\DuckHunt.ico" IDI_DUCKHUNT_SM ICON "Res\\DuckHunt_sm.ico" //Bitmap IDB_DUCK BITMAP "Res\\Duck.bmp" IDB_BACKDUCK BITMAP "Res\\BackDuck.bmp" IDB_BACKGROUND BITMAP "Res\\Background.bmp" IDB_MENUSCREEN BITMAP "Res\\MenuScreen.bmp" //WAV IDW_GUNSHOT WAVE "Res\\GunShot.wav" /*in the IDE, "WAVE" isn't highlighted like the other resources */ //Cursor IDC_CROSSHAIR CURSOR "Res\\CrossHair.cur"Code://incon range: 1000 - 1999 #define IDI_DUCKHUNT 1000 #define IDI_DUCKHUNT_SM 1001 //Bitmap range: 2000 - 2999 #define IDB_DUCK 2000 #define IDB_BACKDUCK 2001 #define IDB_BACKGROUND 2002 #define IDB_MENUSCREEN 2003 //WAV sound range: 3000 - 3999 #define IDW_GUNSHOT 3000 //Cursor range: 4000 - 4999 #define IDC_CROSSHAIR 4000Thanks.Code:PlaySound((LPSTR)IDW_GUNSHOT, g_hInstance, SND_ASYNC | SND_FILENAME);
P.S
When I use "Res\\GunShot.wav" in the play sound function, it works just fine.



LinkBack URL
About LinkBacks



