Loading BASSMOD_MusicLoad from a resource in Delphi
Ok, so I created an RC file:
Chipas RCDATA "chiptune.xm"
And compiled it to RES.
Added this RES, BASSMOD.pas and BASSMOD.dll to my dir project.
Now I need to reproduce this chiptune from resource. How can i do this?
I tried this but it won't load.
procedure play; begin MyResource: = FindResource (HInstance, 'Chipas', RT_RCDATA); if MyResource = 0 then begin showmessage ('chiptune error'); Exit; end; MyGlobal: = LoadResource (HInstance, MyResource); pResource: = LockResource (MyGlobal); ResSize: = SizeOfResource (HInstance, MyResource); BASSMOD_MusicFree; if BASSMOD_MusicLoad (false, pResource, 0,0, BASS_UNICODE) then begin BASSMOD_MusicPlay; end else Error ('Can "t play the file'); FreeResource (MyGlobal); end;
+1
Some1
source
to share
1 answer
One of the functions that you call may signal an error. You have to make sure that every function you call does not signal an error. See the documentation on how they signal an error and use functions such as RaiseLastOSError to see what the error message is. This might help you figure out what the problem is.
Also use the resource editor to see if your executable contains a resource and what is its name or ID.
+1
source to share