![]() |
Re: MDI-Form & MDI-Child & DLL's
This works for me:
The DLL (.dpr):
Delphi-Quellcode:
In your mainform declare like this:
library MyDLL;
uses SysUtils, Classes, Windows, Forms, uMDIChild in 'uMDIChild.pas' {MDIChild}; // This is the unit that contains the mdi child form var PrevApplication: TApplication; PrevScreen: TScreen; procedure DLLEntryProc(EntryCode: integer); begin case EntryCode of DLL_PROCESS_ATTACH: begin // Do Initialization stuff here. Called when a process loads the DLL PrevApplication := Application; PrevScreen := Screen; end; DLL_PROCESS_DETACH: begin // Do Finalization stuff here. Called when a process unloads the DLL Application := PrevApplication; Screen := PrevScreen; end; end; end; procedure CreateForm(A: TApplication; S: TScreen); export; begin Application := A; Screen := S; TMDIChild.Create(Application); end; exports CreateForm; begin DLLProc := @DLLEntryProc; DLLEntryProc(DLL_PROCESS_ATTACH); end.
Delphi-Quellcode:
And create an MDI child like this:
procedure CreateForm(A: TApplication; S: TScreen); external 'MyDLL.dll';
Delphi-Quellcode:
The clientform has a constructor:
CreateForm(Application, Screen);
Delphi-Quellcode:
constructor TMDIChild.Create(AOwner: TComponent);
begin inherited Create(AOwner); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:18 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz