为什么调用BPL里的窗体总是不成功。(0分)

  • 主题发起人 主题发起人 fjfztv
  • 开始时间 开始时间
F

fjfztv

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TfrmDynaLoadBpl.Button1Click(Sender: TObject);<br>var frmEmit: TForm;<br>&nbsp; &nbsp; frmClass: TFormClass;<br>&nbsp; &nbsp; HandlePack: HModule;<br>begin<br>&nbsp; HandlePack := LoadPackage('Emit.bpl');<br>&nbsp; if HandlePack &gt; 0 then<br>&nbsp; begin<br>&nbsp; &nbsp; frmClass := TFormClass((GetClass('TfrmEmit')));<br>&nbsp; &nbsp; if Assigned(frmClass) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Showmessage('TfrmEmit找到');<br>&nbsp; &nbsp; &nbsp; frmEmit := frmClass.Create(Application);<br>&nbsp; &nbsp; &nbsp; if frmEmit.ShowModal = mrOK then<br>&nbsp; &nbsp; &nbsp; &nbsp; self.Caption := GetPropValue(frmEmit, 'SelectText');<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; Showmessage('TfrmEmit未找到');<br>&nbsp; &nbsp; UnloadPackage(HandlePack);<br>&nbsp; end<br>&nbsp; else<br>&nbsp; &nbsp; Showmessage('Emit.bpl未找到');<br><br>end;<br><br><br>已经在包的窗体里包含了<br><br>initialization<br>&nbsp; RegisterClass(TfrmEmit);
 
找到了,原来是在编译EXE文件时,没把OPTIONS 里Packages的Build with runtime packages 打勾。<br><br>可是在发布未装有的Delphi的机子上,是不是也要把相应的bpl一起发布,比如vcl70.bpl,rtl70.bpl
 
后退
顶部