The DFM2PAS utility by Alexei Hmelnov. ---------------------------------------------------------------------------- E-Mail: alex@monster.icc.ru http://monster.icc.ru/~alex/ ---------------------------------------------------------------------------- Purpose: -------- The utility DFM2PAS enables to create corresponding *.pas file for *.dfm file or both *.dfm and *.pas for form resource extracted from executable generated by any existing by now version of Delphi (1.0 .. 4.5) (Thanks to Borland this format had never been changed). Usage: ------ The form resource in Delphi Executable differs from the corresponding *.dfm file in that it doesn't contain an additional header with resource name and size. To extract a form from some Delphi executable do the following: 1. Extract the desired form resource from the corresponding RCData resource section of the file and save it in separate file. You can do it using the Resource Explorer Delphi Example (\DEMOS\RESXPLOR directory). 2. Run DFM2PAS To generate Pascal template for *.dfm file: 1. Run DFM2PAS Results: -------- The Pascal template will contain the declarations of the components mentioned in the resource file, their event handlers (with empty bodies) and the units where the components are declared will be addeed to the USES clause. The utility also generates the text representation of the form resource in the *.txt file. Inheritance: ------------ If the form contained in the resource has other ancestor than TForm (the presence of the word "inherited" in the beginning of the generated *.txt file indicates this) then You should also provide the information about the form ancestor: DFM2PAS or DFM2PAS Component Events: ----------------- To be able to restore the correct declarations of the event handlers the program uses the file "classes.lst", located in the program directory. This file contains all the necessary information about component events. If a component or its event will not be found in the file, then the event handler will be declared as TNotifyEvent = procedure(Sender: TObject), which could be incorrect. The file "classes.lst" can be automatically generated using the Event List Expert and can also be manually edited to include the descriptions of some additional nonstandard components. The Component Event Lister Expert: ---------------------------------- To obtain the file "classes.lst" corresponding to the current state of your component library do the following (it was tested in Delphi 3.0 and may slightly differ for other Delphi versions): 1. Select "Component/Install Component..." in Delphi menu. 2. Press "Browse" button, select the file "EventLst.pas" and press Ok. 3. Answer Yes to the prompt to rebuild the package. 4. Select "Help/Get Component Event List" in Delphi menu. The message will appear reporting where the resulting file will be stored - press Ok. 5. Copy resulting file to the DFM2PAS directory. 6. In the package window Remove the EventLst file and Compile the package.