Delphi to package some DLLs and other generated resource files into a separate EXE program method step

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.