Link to home
Create AccountLog in
Avatar of Xyptilon2
Xyptilon2Flag for China

asked on

How to insert a .wav in the resource of an exe file and play it using Playsound()?

How to insert a .wav in the resource of an exe file and play it using Playsound()?
ASKER CERTIFIED SOLUTION
Avatar of George Tokas
George Tokas
Flag of Greece image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
>>THEWAVFILE WAVE TheWaveFile.wav
Whatever can be used as long as the middle description in this line and the last variable on FindResource() is the same...
I tried that and verify it...:-)
Sometimes one needs to confuse others, like a kind of cryptography....

George Tokas.
Avatar of kode99
kode99

When doing the PlaySound/sndPlaySound methods to directly play the audio  from the resource only 'WAVE' works (using the SND_RESOURCE flag).  I would guess those MS SDK calls have hardcoded thier resource lookups.

If you load it into memory manually you are right,  anything will do as long as you  match the call to what you put in the resource file.

>>When doing the PlaySound/sndPlaySound methods to directly play the audio  from the resource only 'WAVE' works

YES!
What I mean is to insert to and extract from resource...
I'm using that long time now, have all wav files inside a dll but I'm using DirectSound to play them...
DirectSound plays the sounds from a buffer (DirectSoundBuffer)...

George Tokas.
Avatar of Xyptilon2

ASKER

Thanks guys! I got it working!