procedure ObjectBinaryToText(Input, Output: TStream);
and
procedure ObjectTextToBinary(Input, Output: TStream);
// You open a stream say a TMemoryStream, and load the .DFM file into it.
BinaryDFM := TMemoryStream.Create;
BinaryDFM.LoadFromFile('MyDFM.DFM');
// Set the Stream.Position pointer to 0
BinaryDFM.Position := 0;
Create another TMemory stream
TextStream := TMemoryStream.Create;
// Convert the Stream
ObjectBinaryToText(BinaryDFM, TextStream);
TextStream.Position := 0;
// Copy to a TStringList
MyStringList := TStringList.Create;
MyStringList.LoadFromStream(TextStream);
// Do what you want to the StringList
Work()
// Do the opposite to write it back using ObjectTextToBinary(Input, Output: TStream);
That is off the top of my head, but that is it.
Chris
Christopher Crowe (Software Developer)
Microsoft MVP, MCP
Adrock Software
Byte Computer & Software LTD
P.O Box 13-155
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Steven Wild
> Sent: Friday, 30 April 1999 12:19
> To: Multiple recipients of list delphi
> Subject: [DUG]: Reading dfm files
>
>
> I have a need to be able to read in a dfm, alter it, and write
> it back to the dfm file from within another Delphi app.
>
> Does anyone have some code that will read a dfm into ledgeable
> form... into a TstringList would be very helpful ... and then
> write the altered one back out to file.
>
> Why??? Well I want to be able to test and set a value on about 1000
> instances of a small group of components where they are used. Rather
> than open all forms in the project and manually look for each
> possible instance of the components, I want to just be able
> to automate the process. I just thought that automating processes is
> what we are all about so why not do it to dfms as well!
>
> Steven Wild
> Wild Software Ltd
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz