Author: Jonas Bilinkevicius Converting SWF to EXE using Delphi Answer: 1 function Swf2Exe(S, D, F: string): string; 2 //S = Source file (swf) 3 //D = Destionation file (exe) 4 //F = Flash Player 5 var 6 SourceStream, DestinyStream, LinkStream: TFileStream; 7 flag: Cardinal; 8 SwfFileSize: integer; 9 begin 10 result := 'something error'; 11 DestinyStream := TFileStream.Create(D, fmCreate); 12 try 13 LinkStream := TFileStream.Create(F, fmOpenRead or fmShareExclusive); 14 try 15 DestinyStream.CopyFrom(LinkStream, 0); 16 finally 17 LinkStream.Free; 18 end; 19 20 SourceStream := TFileStream.Create(S, fmOpenRead or fmShareExclusive); 21 try 22 DestinyStream.CopyFrom(SourceStream, 0); 23 flag := $FA123456; 24 DestinyStream.WriteBuffer(flag, sizeof(integer)); 25 SwfFileSize := SourceStream.Size; 26 DestinyStream.WriteBuffer(SwfFileSize, sizeof(integer)); 27 result := ''; 28 finally 29 SourceStream.Free; 30 end; 31 finally 32 DestinyStream.Free; 33 end; 34 end; 35 36 procedure TForm1.Button1Click(Sender: TObject); 37 begin 38 Swf2Exe('c:\somefile.swf', 'c:\somefile.exe', 39 'c:\Program Files\Macromedia\Flash MX\Players\SA\FlashPlayer.exe'); 40 end;