views:

181

answers:

1

Ok, So I created a RC file:

Chipas RCDATA "chiptune.xm"

And compiled it to RES.
Added this RES, BASSMOD.pas and BASSMOD.dll to my project dir.

Now I need to play that chiptune from the resource. How can I do it?

I tried this, but it doesn't loads.

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  A: 

One of the functions you are calling could signal an error. You need to make sure each function you call does not signal an error. See the documentation on how they signal an error and use functions like RaiseLastOSError to see what the error message is. That might help you figure out what the problem is.

Also use a resource editor to see if your executable does contain the resource and see what it's name or ID is.

Lars Truijens