2010. január 11., hétfő

Retrieve DFM files from the executable


Problem/Question/Abstract:

Retrieve DFM files from the EXEcutable

Answer:

Delphi Form Files (.dfm) are stored as normal Windows binary resources (rcData) in your executable. Examples of other resources in an .exe: bitmaps, cursors, icons, and strings.

You can use a utility such as Resource Workshop, or the Resource Explorer demo application which comes with D3 (demos\resxplor), to extract any resource from an .exe into a separate file. This means you could easily extract a .dfm resource from the .exe into a separate file.

You can also use the Delphi TResourceStream class to access resource data as a stream, and you can easily copy a resource stream to another stream, such as a file stream or memory stream.

Once you have extracted the .dfm from the .exe, you can use .dfm utility procedures such as ObjectBinaryToText, ObjectTextToBinary, ReadComponentResFile, WriteComponentResFile, TStream.ReadComponent, TStream.WriteComponent, etc., to manipulate the .DFM.

Nincsenek megjegyzések:

Megjegyzés küldése