procedure showform(app:Tapplication;con:shortstring;typeid:integer;fbillid:integer;userid:integer;var open:boolean;var ok:integer);stdcall;
var
  F_wginput:TF_wginput ;
begin
  F_wginput:=TF_wginput.Create(app);
  try
    F_wginput.Icon.Handle:=app.Icon.Handle;
    F_wginput.usr_typeid:=typeid;
    F_wginput.usr_connectstr:=con;
    F_wginput.usr_billid:=fbillid;
    F_wginput.usr_userid:=userid;
    F_wginput.CreateForm();
    F_wginput.brontest();
    F_wginput.Show;
    ok:=1;
  finally
    open:=F_wginput.usr_open;
  end;
end;
exports
  showform;
begin
end.
这是被主窗体调用的dll程式的开始部份代码,我想在此dll窗体close时回传数据'open',
但是又不想用showmodal,
procedure TF_wginput.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  adoquery1.Close;
  adoconnection1.Close;
  usr_open:=false;
end;
如何在close时做数据回传呢?

解决方案 »

  1.   

    运行了这一句open:=F_wginput.usr_open;时,还没有去close窗体,所以 
    回传的不是usr_open:=false;这个数据,我想在close时才回传,如果用.showmodal是可以的,但是我要用.show
      

  2.   

    在onclosequery事件中,先处理回传数据,然后canclose := true;不过我觉得你用消息处理会更好一些吧.
      

  3.   

      F_wginput.Show; 
        ok:=1; 
      finally 
        open:=F_wginput.usr_open; 
      end;
    在f_wginput.show时,程式不会停在此,会一直向下执行,所以open:=f_wginput.usr_open也会执行了,而我想在此DLL窗体close时再回传一个新的数据,就是想传两次,show时一次,close时一次,但是却无法再调用或执行open:=F_wginput.usr_open这句。