Principle:
Put the exe that needs to be included into the input source file, compile it with the original program into an exe file, release the exe when the program runs for the first time, and then call the exe file.
Steps:
1. Create an rc file. It can be written in any text editor. File Format: "Resource Name resource type file name ".
For the resource type, if it is an exe file, it should be an EXEFILE, and if it is a binary file, it is RCDATA.
Create a file float. rc:
Code
1 aexe exefile "E: \ Software \ float.exe"
2. Convert the rc file to the res file.
Copy float. rc to the bin folder in the DELPHI installation directory, execute brcc32 float. rc, and generate float. res.
3. Include this res file into the project file.
Code
1 {$ R float. res}
4. Extract float. EXE from RES.
Code
1 procedure TFormMain. IEEE7541Click (Sender: TObject );
2
3 var
4 t: TResourceStream;
5 begin
6
7 if FileExists('float.exe ') then
8 WinExec('float.exe ', Sw_normal)
9 else
10 begin
11 try
12 t: = TResourceStream. Create (HInstance, 'aexe ', 'exefile'); // HInstance is a handle constant, rwww is the resource name, And EXEFILE is the resource type.
13 t.SaveToFile('float.exe ');
14 finally
15 t. free;
16 end;
17 WinExec('float.exe ', Sw_normal );
18 end;
19 end;
In this way, you can call another exe program in an exe file.