如何在dll中调用窗体
dll 工程中如下; 还有一个form1function showunit1(str:string):longint;stdcall;export;
begin
showmessage(str);
form1.ShowModal;
result:=0;
end;
exports
showunit1;
begin
end.
(文件名mydll.dll)
调用如下:
type
showunit=function(str:string):longint;stdcall;
var
aa:showunit;
libhandle:Thandle;
begin
libhandle:=loadlibrary('mydll');
if libhandle=0 then begin showmessage('fail');exit;end;
@aa:=GetProcAddress(libhandle,'showunit1');
if @aa=nil then begin showmessage('fail');exit;end;
aa('df');
end;
能弹出df对话框,但执行form1.showmodal 出错