Hey everybody,

I have a problem that I just can't figure out. It may be the dumbest question you've ever heard, but I just started assembly programming a month ago. Well anyway, just how do you play wave resources? If you think that it's really clumsy to make wave resources than I'll just play them with SND_FILENAME, but it would be great if I could put the waves in the EXE. Does anyone know how to do this? Any input is appreciated.
Posted on 2004-07-25 23:51:32 by yo|dude|mon
The following describes the addition of binary includes to a resourcefile.
Binary includes obviously can be anything you like :)
Here he's using it to include a gif, but it's not important what the data is.


If the raw data is a file on disk, add this line to .rc file: 1 RCDATA "a.gif", 1 being the resource name.

Otherwise, define it this way:
1 RCDATA
BEGIN
0x6f62, 0x7261, 0x1234
END

Use FindResource + LoadResource to load it into memory.
Posted on 2004-07-26 00:15:22 by Homer
I had everything in the resource that I needed and I had it compiled with the EXE and stuff, but my question is how do I play it from the resource. Sorry I should have been more clear :stupid:
Posted on 2004-07-26 11:38:13 by yo|dude|mon
That should be the Playsound Api. Check out TestDepartments page, it shows how to do it.

http://www.crahkob.com/td/ ; Test Department
Posted on 2004-07-26 11:59:59 by JimmyClif
Here is a sample WinAsm Studio project demonstrating what you are looking for. The code is NOT mine. It is written by "The Apprentice"-don't remember where I got it from.

Regards,

Antonis
Posted on 2004-07-26 15:03:09 by akyprian
I figured out what I was doing wrong earlier I just forgot to post what I am typing now. When I was using PlaySound to get the wave resource I was putting the handle to the window in the second param and not the application instance.

For example,

NOT invoke PlaySound, ADDR TheWave, hWin (Dialog window handle), SND_RESOURCE or SND_ASYNC
but invoke PlaySound, ADDR TheWave, hInstance (App instance handle), SND_RESOURCE or SND_ASYNC

Thanks for the help!
Posted on 2004-07-26 20:05:48 by yo|dude|mon