调用bpl包

对于EXE+BPL的程序开发处理方法:

通过LoadPackage处理
type
    BaseClass = class of TForm
var
 RMShareBaseForm: TForm;
  HModule1: HMODULE;
  FullFilePath: string;
  TmpNum:TBANum;
  aClass: TFormClass;
  staff_id, post_id, org_id, Phone: string;

begin 
  FullFilePath := ExtractFilePath(paramstr(0)) + 'Modules\Share.bpl';
  HModule1 := LoadPackage(FullFilePath);
  aClass :=  BaseClass(findclass('TRMSelectNumberForm');
  if HModule1 <> 0 then
  begin
    try
      RMShareBaseForm :=aClass.Create(Application));
      with RMShareBaseForm do
      begin
        org_id := IntToStr(AppSession.Staff.OrgInfo.OrgID); {部门标识}
        post_id := IntToStr(AppSession.LoginPost.PostId); {岗位标识}
        staff_id := AppSession.Staff.Staffid; {受理工号}
        Phone := SelectPhoneCode('', staff_id, post_id, org_id, '104');
        if Phone <> '' then
        begin
          LbEdt_num.Text := trim(Phone);
        end;
      end;
    finally
      FreeAndNil(RMShareBaseForm);
      UnLoadPackage(HModule1);
    end
  end
end;


首先要对打包的窗口进行注册
RegisterClass(TdefFrom)。

posted on 2004-06-15 09:28  Null  阅读(634)  评论(0)    收藏  举报