Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2001, 07:21 AM
hbah245 hbah245 is offline
Junior Member
 
Join Date: Jan 2001
Posts: 13
Default Need help with Delphi DLL's

In "C", the DLLMain passes the handle to the instance of the calling program

DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)

In Delphi (I'm using Delphi 5), how do I get a copy of that instance handle?

Thank you
Reply With Quote
  #2  
Old 01-04-2001, 11:10 PM
PoseFant PoseFant is offline
Senior Member
 
Join Date: Jan 2001
Posts: 1,002
Default RE: Need help with Delphi DLL's

If I understand you correct ... )

The HINSTANCE of a DLL is the same as the HMODULE of the DLL

To get the HMODULE you may use the Function GetModuleHandle

Example :

Var
DllhInstance : HMODULE;
Begin
DllhInstance := GetModuleHandle(PChar('NETAPI32.DLL'));
End;

DllhInstance may then be used with the DllEntryPoint.


Regards

/Filip
Reply With Quote
  #3  
Old 01-05-2001, 05:17 AM
hbah245 hbah245 is offline
Junior Member
 
Join Date: Jan 2001
Posts: 13
Default RE: RE: Need help with Delphi DLL's

Thanks for the replay, but I need a handle to the calling program not the DLL. Instance in DLLMain(...) is to the calling program. Thanks again...... Possibly in Delphi, it handles the instance of the calling program and installs it into the DLL Application Handle????????
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 07:41 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.