Use the resource file to fix it.
1, first build a new project, save, note this time we do not delete {$R *.res}
2, copy two EXE files to the project directory, for example, the file is: 1.exe, 2.exe
3. Create text file input:
MyFile1 RCDATA "1.exe"
MyFile2 myres "2.exe"
Then save as: 3.rc, and ADD to the project.
4. The project file will be inserted automatically at this time: {$R ' 3.res ' 3.rc '}
5. Add code:
Procedure Tform1.button1click (Sender:tobject);
Var
Rs:tresourcestream;
Begin
RS: = Tresourcestream.create (hinstance, ' MyFile1 ', rt_rcdata);
Rs. SaveToFile (' C:\1.exe ');
WinExec (' C:\2.exe ', 1);
Rs. Free;
End
Procedure Tform1.button2click (Sender:tobject);
Var
Rs:tresourcestream;
Begin
RS: = Tresourcestream.create (hinstance, ' MyFile2 ', ' myres ');
Rs. SaveToFile (' C:\1.exe ');
WinExec (' C:\2.exe ', 1);
Rs. Free;
End
6. Compile all works, run.
DELPHI Package File Method