Teen Programmers Unite  
 

 

Return to forum top

.wav in Win32 App exe's

Posted by ginoitalo [send private reply] at January 04, 2002, 09:22:52 PM

My Second Win32 program....

This one uses .wav files, When i compile and get the exe and run it in a different directory on my PC it doesn't play the sounds cause their not in the directory.

My question is how can I Embed the sound files into the .exe to make it more easily portable ?


http://www.corrado.italy.com/help.gif

CODE CLIPPING :
----------------
LoadResource(NULL, (HRSRC)"GF_Pauly.wav");

LockResource((HRSRC)"GF_Pauly.wav");

PlaySound("GF_Pauly.wav",NULL,SND_FILENAME | SND_ASYNC | SND_RESOURCE);
----------------
This is what i have (screenshot link)
are the files loaded where they should be ?
are the funcation calls (highlited) proper ?

.The .exe file didn't get any larger.


Posted by taubz [send private reply] at January 04, 2002, 10:37:27 PM

You need to create a resource file (usually .rc I think) and put the wav file in it, and then make sure that the .rc file is compiled into your exe. It's easy to do in MS Visual C++ by just creating a new resource file.

- taubz

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.