S
ssjyr
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大富翁们:<br> 关于"动态调用Dll中非模态窗体,释放"的问题已经解决了,用PostMessage消息的方式来解决,但小弟还有一问题,希望大家共同来探讨一下:<br> 下面这段代码是Project1动态调用Project2.dll,如果两次或者多次调用Project2.dll,可否得到不同的句柄或者说标识,然后释放时就不会出错了.不知各位有没有办法?<br><br>谢谢了.<br><br>Project1:<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> ProcAddr: FarProc;<br> DllShow: TDllShow;<br>// frmDll: TForm;<br>begin<br>// if DllHandle = 0 then<br> try<br> DllHandle := LoadLibrary('Project2.dll');<br> ProcAddr := GetProcAddress(DllHandle, PChar('LoadDLL'));<br>// @DllShow := GetProcAddress(DllHandle, PChar('LoadDLL'));<br> if assigned(ProcAddr) then<br> begin<br> DllShow := ProcAddr;<br>// DllShow := TDllShow(ProcAddr);<br>// frmDll := DllShow();<br> DllShow(Handle, wm_user);<br>// SHOWWindow(frmDll.Handle, SW_SHOWNA);<br> end;<br><br> finally<br>// freelibrary(DllHandle);<br> end;<br>end;