I'm a beginner. I have received a .rar
file containing a bunch of files. I think that they are used to generate Forms.
Here's an example:
BackupManager.dfm
BackupManager.pas
WaveControl.dfm
WaveControl.pas
So, can anyone help me understand exactly how to use them?
A .dfm
file contains the property values and sub object definitions of a Form. The .pas
file that has the same base filename as the .dfm
file contains the Delphi Pascal source code for the Form, its event handlers, etc.
To use these files, simply create a Delphi VCL Forms project and add the .pas
files to the project. Each .pas
file should have a {$R *.dfm}
compiler directive in it to link to its associated .dfm
file.
The compiler will compile each .pas
file into a .dcu
file and link it into the final executable, and will also create a separate binary resource for the content of each .dfm
file and link them into the executable as well.
When the executable is run and it tries to create an instance of a Form class (either automatically at startup, or explicitly in code), the RTL will automatically load the appropriate DFM resource and parse it to construct the necessary sub objects, assign their property values, and hook up their event handlers.