Martin Ease asked:
> Does anyone using D5 have a tool which saves existing forms as text?
> Changing the option in Environment only effects new forms.
All you need to do to convert a file to a text based DFM is to use the
following routine to do the job. Conbine this with some directory walking
code and you can quickly convert an entire project over.
procedure ProcessFile(const Filename: String);
var
DFMStream: TFileStream;
NewStream: TMemoryStream;
begin
DFMStream := nil;
NewStream := nil;
try
DFMStream := TFileStream.Create(Filename,
fmOpenReadWrite or fmShareExclusive);
NewStream := TMemoryStream.Create;
if TestStreamFormat(DFMStream) <> sofText then
begin
ObjectResourceToText(DFMStream, NewStream);
DFMStream.Position := 0;
DFMStream.CopyFrom(NewStream, 0);
DFMStream.Size := NewStream.Size
end
finally
DFMStream.Free;
NewStream.Free;
end;
end;
Cheers, Max.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz