Does anyone know how can I include a picture and a .wav file into my .exe file? ( C++ )
If i run the build PlaySound(TEXT("Audio.wav"), NULL, SND_FILENAME | SND_ASYNC);
it will work well, but if a another person opens the .exe where the .wav file is not in the same direction the sound won`t play, how can i include the audio into the .exe?
Asked
Active
Viewed 522 times
-1

MindSwipe
- 7,193
- 24
- 47
-
https://stackoverflow.com/questions/7288279/how-to-embed-a-file-into-an-executable – Nikos Athanasiou Apr 13 '21 at 16:30
-
Hello and welcome to Stack Overflow. For future reference: Please tag your question with only one language tag at a time. I came here from the (irrelevant) C# tag and can't help you – MindSwipe Apr 14 '21 at 06:23
1 Answers
1
Firstly, I suggest you could try to add the files to your project as resources, then you could try to use PlaySound function to use them.
I suggest you could refer to the thread:PlaySound works in Visual Studio but not in standalone exe

Jeaninez - MSFT
- 3,210
- 1
- 5
- 20
-
Yes, I added the .wav file to my project as a ressource, but it isn't included in the .exe, so the .wav file must be in the same directory to work. – Thomas Becker Apr 14 '21 at 17:44
-
@ThomasBecker Instead of adding it to the project reference, you add the embed code to .rc file, for example icon: `IDI_SMALL ICON "small.ico"`, you should add your line as: `IDI_WAV 256 "your.wav"`. – Drake Wu Apr 15 '21 at 03:40