标签:
procedure TForm1.FormCreate(Sender: TObject); var ARttiContext: TRttiContext; ARttiPackage: TRttiPackage; begin ARttiContext := TRttiContext.Create; for ARttiPackage in ARttiContext.GetPackages() do begin if SameText(ExtractFileName(ARttiPackage.Name), ‘TEST.BPL‘) then begin ARttiInstanceType := ARttiPackage.FindType(‘Unit2.TFORM2‘) as TRttiInstanceType; if ARttiInstanceType <> nil then begin begin Frm := ARttiInstanceType.MetaclassType.Create as TForm; Frm := Frm.Create(Application); Frm.Show; end; Break; end; Application.ProcessMessages; end; end;
在调用前别忘记加载包文件LoadPackage(‘Form2.bpl‘);
标签:
原文地址:http://www.cnblogs.com/Kim53622744/p/4389813.html