線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:872
推到 Plurk!
推到 Facebook!

通过dll调用窗口,出现问题?

尚未結案
nxwuyong
一般會員


發表:10
回覆:3
積分:2
註冊:2004-09-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-03-18 12:26:15 IP:211.93.xxx.xxx 未訂閱
主程序: DllFileName:=trim(DM.SQL_sys_menu.FieldValues['func_id']); DLLHandle:= LoadLibrary(Pchar(DllFileName)); if DLLHandle <> 0 then begin @ProcAddr := GetProcAddress(DLLHandle, 'CreateDllForm'); if @DLLForm <> nil then DLLForm := ProcAddr(Application, Screen ); end; dll程序: function CreateDllForm(ParentApplication: TApplication; Scr:TScreen):TForm; stdcall; { Called whenever DLL entry point is called } var Filename:string; v_user_id:string; myinifiles:Tinifile; s:string; v_flag:string; begin Application:=ParentApplication; Screen :=Scr; Application.CreateForm(Tdm_pass, dm_pass); Filename:=ExtractFilePath(paramstr(0)) 'onconfig.ini'; myinifiles:=Tinifile.create(Filename); v_user_id:=myinifiles.ReadString('login_info','user_id',''); myinifiles.Destroy; s:='select * from login_info where user_id="'; s:=s trim(v_user_id) '"'; try dm.Q_login_info.Close; dm.Q_login_info.DataSet.CommandText:=s; dm.Q_login_info.Open; v_flag:=dm.Q_login_info.FieldValues['flag']; except dm.Q_login_info.Close; showmessage('连接Login_info表失败,请速与系统管理员联系!'); result:=nil; exit; end; dm.Q_login_info.Close; if (trim(v_flag)='1') or (trim(v_flag)='0') then begin Application.CreateForm(Tgrp_passwd_form, grp_passwd_form); result:=grp_passwd_form; end else begin Application.CreateForm(Tsign_passwd_form, sign_passwd_form); result:=sign_passwd_form; end; end; 第一次调用没有问题,但是不能第二次、第三次调用,将dll程序中Application.CreateForm(Tdm_pass, dm_pass); 去掉,就可以重复调用,why?
mustapha.wang
資深會員


發表:89
回覆:409
積分:274
註冊:2002-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-03-18 17:43:31 IP:218.80.xxx.xxx 未訂閱
怎么每次都调用Application.CreateForm(Tdm_pass, dm_pass); 创建出的dm_pass也没有看到释放。    BTW,贴代码保持缩进请用code标签。     久病成良医--多试 千人之诺诺,不如一士之谔谔--兼听
------
江上何人初见月,江月何年初照人
系統時間:2024-07-01 5:41:59
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!