Well, this doesn’t really deal with MFC, but its useful knowledge if you don’t know how..
Parts of this code I ripped from VC++ 4.1 help, but it was outdated and didn’t come close to working.
First of all you need to add the wave files to the .rc file manually like so:
<NameOfSound> WAVE <Location of WAVE.>
Cool WAVE C:projectssoundscool.wav
Then you need to add this function declarion to the class you plan on using..
BOOL PlayResource(LPSTR lpName)
/* Find the WAVE resource. */
if(hResInfo == NULL)
/* Load the WAVE resource. */
hRes = LoadResource(Nl,hResInfo);
if (hRes == NULL)
/* Lock the WAVE resource and play it. */
bRtn = sndPlaySound(lpRes, SND_MEMORY | SND_SYNC);
if(bRtn == NULL)
/* Free the WAVE resource and return success or failure. */
Then to play the sound you simply use: