🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools
Article #513

Re: What is the best way to get HINSTANCE of a DLL?

#513
From: Tom W. Brown
Date: Tue, 10 Nov 1992 23:06
21 lines
1519 bytes
In article <1992Nov9.070214.3613@leland.Stanford.EDU>, kmh@leland.Stanford.EDU (khanhmy hoang) writes:
|> 
|> 	I am in an DLL and need to do a LoadString from the DLL's stringtable
|> 	and wonder what is the nicest way to get the HINSTANCE of the DLL to
|> 	use as LoadString's first argument.

The DLL is given its module handle (an HINSTANCE) as a parameter to LibMain.
You should save this value in the data segment of the library to use for
this purpose.

Methods that rely on a module handle being related in some way to DS are
fraught with peril and are probably doomed when you port to NT.

NOTE: followups directed to comp.os.mw-windows.programmer.misc


----------------------------------------------------------------------------
Tom Brown               |  "'ow d'you know 'e's a king?
PE Nelson Systems       |            'cause 'e 'asn't got shit all over 'im!"
twbrown@pe-nelson.com   |                    Monty Python and the Holy Grail
----------------------------------------------------------------------------
Technical Details
Message-ID: <690@lax.lax.pe-nelson.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown
References: <1992Nov9.070214.3613@leland.Stanford.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown
From: twbrown@PE-Nelson.COM (Tom W. Brown)
Newsgroups: comp.os.ms-windows.programmer.tools
Subject: Re: What is the best way to get HINSTANCE of a DLL?
Message-ID: <690@lax.lax.pe-nelson.com>
Date: 10 Nov 92 23:06:12 GMT
References: <1992Nov9.070214.3613@leland.Stanford.EDU>
Sender: news@lax.pe-nelson.com
Followup-To: comp.os.ms-windows.programmer.misc
Distribution: usa
Organization: PE-Nelson
Lines: 21