Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

playing .wav files from resource files (.res)

Status
Not open for further replies.

WoundEdGoat

Programmer
May 10, 2002
39
CA
Can someone tell me how to use the LoadResData() command to play a .wav file?
 
You might struggle to play a .WAV file from a resource file, they're generally pretty big, but here's the basic idea which will work for extracting any type of file from a resource file. You can't play the WAV file directly while it's in memory (or maybe you can but I haven't a clue how), so store it in a .WAV file first:

Dim WAVFile() as Byte

ReDim WAVFile(0)
WAVFile = LoadResData("WAVHandleInResourceFile", "CUSTOM")
Open "c:\wavfile.wav" For Binary Access Write As 1
Put #1, 1, WAVFile
Close 1

...and in your Resource file:

WAVHandleInResourceFile CUSTOM c:\source\homerdoh.wav

- Andy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top