embeddind a midi file in an exe using resource file
Posted on 2002-03-14
A few days ago I asked this question and recieved a reply I was given code snippets to create the res file and how to implement it but program doesn't work! When I press the button i've created I get an error msg that says cannot find the resource. here is the code i was given. can anyone help? I believe Tongalite and Reddarin responded previously.
here is the code.
THE RESOURCE FILE:
midfile RC_DATA "twelve.mid"
I have tried puttingthe name in single quote, double quotes and no quotes.
Incidently, the code I was given for playing a wav file works, but not when I replace it with the midi data.
Code attached to the button.
procedure TForm1.Button1Click(Sender: TObject);
restr := TResourceStream.Create(hInstance, 'midfile', RT_RCDATA);
fileStr := TFileStream.Create('C:\temp.mid',fmCreate or fmOpenWrite);
MediaPlayer1.filename := 'C:\temp.mid';
Where restr is assignned the value of Tfilestream is where the program stops.