通过dll调用窗口,出现问题? |
尚未結案
|
nxwuyong
一般會員 發表:10 回覆:3 積分:2 註冊:2004-09-17 發送簡訊給我 |
主程序:
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 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |