您的位置:程序门 -> delphi -> windows sdk/api



主程序调用dll,dll中的窗体为什么create后就直接调用formshow中的代码,高手作答!!在线等待。。。。。。


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


主程序调用dll,dll中的窗体为什么create后就直接调用formshow中的代码,高手作答!!在线等待。。。。。。
发表于:2008-01-09 11:00:24 楼主
我在主程序中动态调用dll。为何在dll中创建窗体后立刻进入窗体的onshow过程中呢?代码如下:

主程序:
showform(self.handle,   self.cxpb_downfile,   pchar('a'),pchar(loginusername),pchar(loginuserpwd),pchar('a'),nil,nil,loginuserjb,currentkc,webclass);
其中self.cxpb_downfile是一个进度条控件,webclass是自定义的一个类实例
dll文件:
procedure   showform(ahandle:   thandle;cxpb_downfile:tcxprogressbar;dllfilename,   username,   password,usergroupname,
    extendparam1,   extendparam2:   pchar;userjb:integer;currentkc:string;webclass:twebclass);   stdcall;
begin
    application.handle   :=   ahandle;
    frm_bm   :=   tfrm_bm.create(nil);//程序执行到此后,直接调用   tfrm_bm.formshow,未执行下列5行代码
    frm_bm.cxpb_downfile:=cxpb_downfile;
    frm_bm.loginusername:=username;
    frm_bm.loginuserpwd:=password;
    frm_bm.loginuserjb:=userjb;
    frm_bm.webclass:=webclass;
    frm_bm.currentkc:=currentkc;
    frm_bm.showmodal;
    frm_bm.free;
end;

procedure   tfrm_bm.formshow(sender:   tobject);
var
    i:integer;
    bmnums:integer;
    servermd5:string;
begin
    gettableinfoxx('gettable_jbyy_info','table_jbyy');
    gettableinfoxx('gettable_xb_info','table_xb');
    gettableinfoxx('gettable_mz_info','table_mz');
    gettableinfoxx('gettable_zy_info','table_zy');
    gettableinfoxx('gettable_whcd_info','table_whcd');
    gettableinfoxx('gettable_blcjzl_info','table_blcjzl');
    gettableinfoxx('gettable_cjpxzl_info','table_cjpxzl');
    bmnums:=getbmnum;
    filldataset;
    if   (   bmnums <> self.stu_set.recordcount)   then
    begin
        getbmxx('0')   ;
        filldataset;
    end;
end;
发表于:2008-01-09 13:00:371楼 得分:0
up
发表于:2008-01-09 16:49:302楼 得分:0
不是   有   “frm_bm.showmodal;   ”吗,执行到这里窗体就进行模式显示了,直到用户输入模式窗体显示结果(ok   or   cancel),然后“frm_bm.free;   ”


快速检索

最新资讯
热门点击