Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-1999, 01:16 AM
N/A
Guest
 
Posts: n/a
Default How can I put a MDI-child in a DLL?

I need to load the DLL's at runtime,

if that makes any difference.



Please Help...
Reply With Quote
  #2  
Old 02-11-1999, 03:19 AM
N/A
Guest
 
Posts: n/a
Default RE: How can I put a MDI-child in a DLL?

// THIS WORKS WITH DELPHI 4.0

// IT MAY WORK WITH OTHERS

// PUT THIS IN THE DLL .DPR UNIT

exports

*showMDIChild;



begin

DLLProc := @MyDLLProc;



// PUT THIS IN A DLL UNIT

procedure ShowMDIChild(MainApp : TApplication); export;

procedure MyDLLProc(Reason: Integer);

var DllApp : TApplication;





implementation



procedure ShowMDIChild(MainApp : TApplication); export;

var

*Child : Tform1;

begin

*if not Assigned(DllApp) then begin

* *DllApp := Application;

* *Application := MainApp;

*end;

*Child := Tform1.Create(Application.MainForm);

*Child.Show;

end;



procedure MyDLLProc(Reason: Integer);

begin

*if Reason = DLL_PROCESS_DETACH then

* *{ DLL is unloading. Restore the Application pointer. }

* *if Assigned(DllApp) then

* * *Application := DllApp;

end;



// PUT THIS IN THE EXE

procedure ShowMDIChild(application : tapplication); external 'd_prj.dll';



procedure TForm1.MDIfromdll1Click(Sender: TObject);

begin

ShowMDIChild(application);



end;



=================

It shouldn't make any difference when the

dll is loaded just as long as it "is loaded"

by the time you call into it.



Hope this helps.



Craig
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 08:23 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.