J
jh_muse
Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个dll名字为testdll1,里面包含一个子窗口,主程序为testmain里面包含主窗口,在调用时报如下两个错误:
Project testMain.exe raised exception class EInvalidOperation with message 'Cannot make a visible window modal'.Process stopped.Use Step or Run to continue.
Exception EInvalidOperation in module testdll1.dll at 0005BF31.
我将调用和被调程序贴出来
dll中的被调程序
procedure jh(mainform:Tform);stdcall;
var
ptrLongInt;
form1:tfrm_carinfo;
begin
ptr:=@(application.MainForm);
ptr^:=longint(mainform);
form1:=tfrm_carinfo.Create(mainform);
form1.ShowModal; //错误出现在这句
end;
主程序中的调用程序
procedure Tfrm_mainOPT.menu_CarInfoClick(Sender: TObject);
type
mypointer=procedure(form:TForm);stdcall;
var
showform:mypointer;
Moudel: THandle;
begin
moudel:=Loadlibrary('testdll1.dll');
if Moudel > 32 then
begin
showform:= GetProcAddress(moudel, 'jh');
showform(application.MainForm);
FreeLibrary(moudel);
end;
end;
Project testMain.exe raised exception class EInvalidOperation with message 'Cannot make a visible window modal'.Process stopped.Use Step or Run to continue.
Exception EInvalidOperation in module testdll1.dll at 0005BF31.
我将调用和被调程序贴出来
dll中的被调程序
procedure jh(mainform:Tform);stdcall;
var
ptrLongInt;
form1:tfrm_carinfo;
begin
ptr:=@(application.MainForm);
ptr^:=longint(mainform);
form1:=tfrm_carinfo.Create(mainform);
form1.ShowModal; //错误出现在这句
end;
主程序中的调用程序
procedure Tfrm_mainOPT.menu_CarInfoClick(Sender: TObject);
type
mypointer=procedure(form:TForm);stdcall;
var
showform:mypointer;
Moudel: THandle;
begin
moudel:=Loadlibrary('testdll1.dll');
if Moudel > 32 then
begin
showform:= GetProcAddress(moudel, 'jh');
showform(application.MainForm);
FreeLibrary(moudel);
end;
end;