在delphi的exe檔案中嵌入另外一個exe檔案

來源:互聯網
上載者:User

標籤:文本   包含   轉換   http   檔案名稱   create   exe程式   code   res   

http://www.cnblogs.com/dabiao/archive/2009/11/28/delphi.html

 

 1、建立rc檔案。可以用任意文字編輯器來寫。檔案格式為:"資源名 資源類型 檔案名稱"。

          對於資源類型,如果是exe檔案,應該是EXEFILE,如果是二進位檔案,則是RCDATA。  

           這裡建立一個檔案float.rc:

AEXE EXEFILE "E:\Software\float.exe"

2、將這個rc檔案轉換成res檔案。

         複製float.rc到DELPHI安裝目錄裡的bin檔案夾, 執行brcc32 float.rc,產生float.res 

 

     3、將這個res檔案包含至工程檔案中。

{$R   float.res}

4、提取RES中的float.EXE。

代碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1procedure TFormMain.IEEE7541Click(Sender: TObject); 3  var   t : TResourceStream; begin 7  if FileExists(‘float.exe‘) then   WinExec(‘float.exe‘,Sw_normal) else   begin     try       t := TResourceStream.Create(HInstance,‘AEXE‘,‘EXEFILE‘); //其中HInstance為一個控制代碼常量;rwww為資源名;exefile為資源類型      t.SaveToFile(‘float.exe‘);     finally       t.free;     end;     WinExec(‘float.exe‘,Sw_normal);   end; end;

  這樣,就可以在一個exe檔案中,調用另外一個exe程式了。

在delphi的exe檔案中嵌入另外一個exe檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.