To dingbaosheng:
大概写了一个,你看看,不过,这样做出来的东东比Flashpla.exe生成的要大一些。
function Swf2Exe(SwfFile,ExeFile:string):Boolean;
var
Ss,Es,ps:TFileStream;
player:string;
Flag,Ssize:Longint;
begin
result:=False;
if Not FileExists(SwfFile) then exit;
if ExeFile='' then
Exefile:=invertfileNameExt(SwfFile)+'.exe'
else if Lowercase(ExtractFileExt(ExeFile))<>'.exe' then
Exefile:=invertfileNameExt(ExeFile)+'.exe';
Player:=Apppath+'Flashpla.exe';
while Not FileExists(player) do begin
if not inputdialog('Error','Flashpla.exe not exists',Player) then exit;
end;
try
Es:=TfileStream.Create(ExeFile,fmcreate);
try
// Write Flashpla.exe
try
ps:=TFileStream.create(player,fmOpenRead);
Ss:=TFileStream.create(SwfFile,FmOpenRead or fmShareExclusive);
Es.CopyFrom(ps,0);
Es.CopyFrom(SS,0);
//Write Flag
Flag:=$FA123456;
Es.Write(Flag,sizeof(Longint));
//write Swf File Length
Ssize:=Ss.Size;
Es.Write(SSize,sizeof(Longint));
finally
ps.free;
ss.free;
end;
result:=True;
except
SHowMessage('Error Occur');
end
finally
Es.Free;
end;
end;