我现在有二个EXE文件
A.exe 有一个FLASH播放器,并加载了一个a.swf
B.exe 要求能够替换A.exe中的a.swf 更改成 b.swf 然后生成C.exe谁能帮我想想有什么办法实现这个流程

解决方案 »

  1.   

    exe和asf分开进行,直接替换asf即可,不用生成b.exe
      

  2.   

    分离出a.exe中的a.swf,使用流操作可以实现。N久前的代码(Exe文件中提取Flash文件),供你参考:
    function Exe2Swf ( SourceFile : String ) : Boolean;
    var
        SourceStream : TFileStream;
        DestStream   : TMemoryStream;
        TmpBuf : Array [0..3] of Byte;
        SWFLength : DWORD;
    begin
        if not FileExists ( SourceFile ) then
            exit;    SourceStream := TFileStream.Create( SourceFile, fmOpenRead or fmShareExclusive  );
        DestStream   := TMemoryStream.Create;    try
            SourceStream.Seek ( SourceStream.Size - 8, soFromBeginning );
            SourceStream.Read ( TmpBuf, 4 );        //Check the flash of flash exe file!
            if ( Byte ( TmpBuf [0] ) <> $56 ) or
               ( Byte ( TmpBuf [1] ) <> $34 ) or
               ( Byte ( TmpBuf [2] ) <> $12 ) or
               ( Byte ( TmpBuf [3] ) <> $FA ) then
            begin
                Application.MessageBox('The file you selected is not a flash exe file!', 'File format error!', MB_OK+MB_ICONINFORMATION );
                Result := false;
                exit;
            end;        SourceStream.Seek ( SourceStream.Size - 4, soFromBeginning );
            SourceStream.Read ( TmpBuf, 4 );        Try
                SWFLength := Ord ( Byte ( TmpBuf[3] ) );
                SWFLength := SWFLength shl 8 + Ord ( Byte ( TmpBuf[2] ) );
                SWFLength := SWFLength shl 8 + Ord ( Byte ( TmpBuf[1] ) );
                SWFLength := SWFLength shl 8 + Ord ( Byte ( TmpBuf[0] ) );
            except
                Application.MessageBox('Error!', 'Error!', MB_OK );
                Result := false;
            end;        SourceStream.Seek ( SourceStream.Size - 8 - SWFLength, soFromBeginning );
            DestStream.CopyFrom( SourceStream, SWFLength );        DestStream.SaveToFile ( ChangeFileExt ( SourceFile, '.swf') ); 
        finally
            SourceStream.Free;
            DestStream.Free;
        end;    Result := true;
    end;至于a.swf到c.exe,反过来就可以了!
      

  3.   

    不知道楼上的理解了楼主的意思,还是我理解了楼主的意思.a.swf 应该是独立的.  b.exe 只需要替换掉 a.exe 调用的a.swf 即可. 也就不用生成c.exe . 如果a.exe在运行.  就用b.exe 先关闭a.exe , 再替换a.swf. 再打开a.exe .