Resource file is typically a file with the extension res, and its own resource compilation tool BRCC32.EXE (in/delphi/bin directory)
1. Write the RC script text
Write a file with the extension RC in Notepad or another text editor in the format of the actual file name, type, and so on in the resource file.
For example, to demo the file name. DLL files into a resource file, first create a new text document, enter the content
Mydemodll RCDATA demo. DLL
Mydemodll and RCDATA You can write it casually, this is to define the name and type when you use the resource. You can also do this: a B demo. DLL
Saves the text and then changes the text suffix (. txt) to (. rc)
2. Compiling the RC file into a res resource file
Copy the script file and the actual file to the directory where the Brcc32.EXE is located, and execute the DOS command. The format is: Brcc32 script file (carriage return),
For example:
Copy the above mydll.rc and demo.Dll to the Brcc32.EXE directory, execute BRCC32 mydll.rc (carriage return). If the compilation succeeds, a Mydll.res file is generated, which is the resource file we need.
3. Add a resource file to the Delphi unit
Copy the generated res resource file to the path of your program, and add a {$R mydll.res after the cell file {$R *DFM} }, the res file is added and the compiled resource file is included in the executable file. If you have more than one resource file, you can also add it by using the same method.
Note: If successful, will find that the compiled Exe program size will suddenly increase (the size of the dll file is added)
PS: In the Delphi program can also invoke the resource file (can also run in the EXE resource file, such as in the EXE directly run another EXE, or call DLL, etc., the reason is not written)
Delphi will be some DLL and other generated resource files are packaged into a separate EXE program method step