Paul Lowman asks:

> anyone know of a
> way to either translate them or otherwise load them into D4 ?

The following code shows you how to do this conversion using Delphi's
internal utility routines.

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) <> sofBinary then
      begin
        ObjectTextToResource(DFMStream, NewStream);
        DFMStream.Position := 0;
        DFMStream.CopyFrom(NewStream, 0);
        DFMStream.Size := NewStream.Size
      end
  finally
    DFMStream.Free;
    NewStream.Free;
  end;
end;

All the code that does this sort of DFM format changing and the like are in
Classes.pas.

Cheers, Max.


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to