首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

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

2013-05-02 
MDI静态调用DLL创建窗体的问题MDI的问题exe是fsMDIFormdll是fsMDIChildexe静态调用dll创建窗体麻烦问下为

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方式比较稳定安全,但是编译发布不方便

热点排行