PlaySound('ONLINE2', HInstance, SND_RESOURCE);
<Resource_0 FileName="audio\online2.wav" Type="RCDATA" ResourceName="ONLINE2"/>
Otherwise, you can manually obtain a memory pointer to the resource data using FindResource()/LoadResource()/LockResource(), and then use SND_MEMORY instead of SND_RESOURCE to play it.
Allways trouble with the Windows resource files. Neverending story.
Use the Lazarus resource files. You have to convert your WAV-file (or any other file) to an .lrs file:
lazres sound.lrs ONLINE2.WAV
And then copy the sound.lrs to your source file directory.
And in your unit1 you have to write
implementation {$I sound.lrs }
One problem less.
Winni
Otherwise, you can manually obtain a memory pointer to the resource data using FindResource()/LoadResource()/LockResource(), and then use SND_MEMORY instead of SND_RESOURCE to play it.
Can you give me an simple example of that?
@bmcsoft: Did you try Remy's code? Here is another variant which I tested to work:
So body of the string has offset +1.
My variant of code works fine with
a pointer to the body of the string (offset 0).
So body of the string has offset +1.
Using a string to hold non-textual binary data is a bad idea.Why?