...get form resource (*.dfm) as text from running program?

Author: P. Below
Homepage: http://www.teamb.com

Category: Misc

procedure TForm1.Button1Click(Sender: TObject);
var
  rs: TResourceStream;
  ms: TMemoryStream;
begin
  rs := TResourceStream.Create(HInstance, ClassName, RT_RCDATA);
  try
    ms := TMemoryStream.Create;
    try
      ObjectBinaryToText(rs, ms);
      ms.Seek(0, 0);
      memo1.Lines.LoadFromStream(ms);
    finally
      ms.Free;
    end;
  finally
    rs.Free;
  end;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base