Delphi - Make a Delphi program that Self-extract a MIDI file -


i'm writing program in delphi 7, , think in put music run in background. so, composed song in .midi called song.mid, want put delphi program self-extract(sfx) song , execute, in end of program delete it. it's write in hex, think. how can it?

create new text file, , write: midi rcdata 1.mid, save text file mid.rc create new text file, , write: brcc32 mid.rc, save "brcc.bat"

run brcc.bat, convert *.rc file *.res move mediaplayer form (the media player on "system"tab). copy code project:

unit unit1;  interface  uses   windows, messages, sysutils, variants, classes, graphics, controls, forms,   dialogs, mplayer;  type   tform1 = class(tform)     mplayer: tmediaplayer;     procedure formcreate(sender: tobject);   private     { private declarations }   public     { public declarations }   end;  var   form1: tform1;  implementation  {$r *.dfm} {$r mid.res}  procedure tform1.formcreate(sender: tobject); var   stream:tresourcestream;   tmp:string; begin   try     stream:=tresourcestream.create(hinstance,'midi',rt_rcdata);     try       setlength(tmp,300);       setlength(tmp,gettemppath(300,pchar(tmp)));       tmp:=tmp+inttostr(hinstance)+'.mid';       stream.savetofile(tmp);           stream.free;     end;     mplayer.filename:=tmp;     mplayer.open;     mplayer.play;   except   end; end;  end. 

this easiest example. so, keygens use special sound format - *.xm, file read memory resource , played using libraries fmod (read more in internet)


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -