W
wind1278wind
Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个主程序来调用dll中的子程序.(主界面要调用9个dll方式的子程序).可是每当我用
freeLibrary卸载dll的时候.主程序就不见了.请问各位高手这是怎么一会事情.如果我不卸载
它就会在运行一段时间死机
我得调用方式如下:.
Th:=LoadLibrary('Yzyw.dll');
if Th>0 then
try
@TIntFunc:=GetProcAddress(Th,PChar('ShowForm'));
if Assigned(TIntFunc) then begin
uRet:=TIntFunc(Application.Handle,IsCardIn);
end
else
ShowMessage('ShowForm函数没有找到');
Except
FreeLibrary(Th);
end
卸载放在下一次调用之前.
freelibrary(th);
Th:=0;
dll中:
function ShowForm(AHandle:THandle;ACaption:String):LongInt;stdcall;
begin
Application.Handle :=AHandle;
if ACaption='InCard' then
begin
if Not Assigned(FrmInCard) then
FrmInCard:=TFrmInCard.Create(Application);
try
Result:=LongInt(FrmInCard);
FrmInCard.Show;
Except
Result:=-1;
end;
end;
end;
请各位高手帮忙解决一下.很急!!!!!!!!!!!!!!!!!!!!!!
freeLibrary卸载dll的时候.主程序就不见了.请问各位高手这是怎么一会事情.如果我不卸载
它就会在运行一段时间死机
我得调用方式如下:.
Th:=LoadLibrary('Yzyw.dll');
if Th>0 then
try
@TIntFunc:=GetProcAddress(Th,PChar('ShowForm'));
if Assigned(TIntFunc) then begin
uRet:=TIntFunc(Application.Handle,IsCardIn);
end
else
ShowMessage('ShowForm函数没有找到');
Except
FreeLibrary(Th);
end
卸载放在下一次调用之前.
freelibrary(th);
Th:=0;
dll中:
function ShowForm(AHandle:THandle;ACaption:String):LongInt;stdcall;
begin
Application.Handle :=AHandle;
if ACaption='InCard' then
begin
if Not Assigned(FrmInCard) then
FrmInCard:=TFrmInCard.Create(Application);
try
Result:=LongInt(FrmInCard);
FrmInCard.Show;
Except
Result:=-1;
end;
end;
end;
请各位高手帮忙解决一下.很急!!!!!!!!!!!!!!!!!!!!!!