procedure TfrmMainForm.btn_Loading_DFM_file_as_a_FormClick(Sender: TObject); var myNewDFM: TStream; myStreamToWorks: TStream; begin try myNewDFM := TFileStream.Create('myNewDFMfile.dfm', fmOpenRead); myStreamToWorks := TMemoryStream.Create; try myNewDFM.Seek(0, soFromBeginning); // ObjectTextToBinary(myNewDFM, myStreamToWorks); // myStreamToWorks.Seek(0, soFromBeginning); // frmMainForm.DestroyComponents; // destroying current comoponents... // // try comment this line to see that the components dont will be "loaded"... myStreamToWorks.ReadComponent(frmMainForm); // receiving the components definitions... // except on E: Exception do ShowMessage('My Error: ' + E.message); end; finally myNewDFM.Free; myStreamToWorks.Free; end; end;
initialization
ReportMemoryLeaksOnShutdown := true;
finalization
end.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3