读书人

MDI静态调用DLL创建窗体的有关问题

发布时间: 2013-05-02 09:39:29 作者: rapoo

MDI静态调用DLL创建窗体的问题
MDI的问题

exe是fsMDIForm
dll是fsMDIChild
exe静态调用dll创建窗体
麻烦问下为什么exe的 MDIChildCount值为0的说
我看了下MDIChildCount是获取Screen的数量,
难道调用dll创建的不属于Application.MainForm的MDIChild吗?
怎样才可以让调用dll创建出来的Form属于exe的MDIChild?
下面是dll的代码

library dllForm;

uses
SysUtils,
Classes,
Forms,
Windows,
test_Form in 'test_Form.pas' {testForm};

{$R *.res}

var
DLLApp: TApplication;

procedure ShowChild(ParentApplication:TApplication;ParentForm:TForm);stdcall;
begin
Application:=ParentApplication;
testForm:=TtestForm.Create(ParentForm);
testForm.Show;
end;

procedure DLLUnloadProc(Reason:Integer);register;
begin
if Reason=DLL_PROCESS_DETACH then Application:=DLLApp;
end;

exports
ShowChild;

begin
DLLApp:=Application;
DLLProc := @DLLUnloadProc;
end.
MDI EXE dll Windows Delphi
[解决办法]
testForm:=TtestForm.Create(ParentForm);//这句后边加
testform.parent := parentform;
[解决办法]
Application.Handle 要传给dll
[解决办法]
用dll 方式就是担心这种情况
用bpl方式比较稳定安全,但是编译发布不方便

读书人网 >.NET

热点推荐