Re: HINSTANCE inside a DLL

From: ama (a.m.a_at_videotron.ca)
Date: 12/20/04


Date: Mon, 20 Dec 2004 06:02:53 -0500


"Tim Robinson" <tim.gaat.freeserve.co.uk@nowhere.com> wrote in message
news:32nf2nF3nubenU1@individual.net...
> Jerry Coffin wrote:
>>>I have a dynamic DLL with a string table resource inside.
>>>When i call the API LoadString(...) i need a HINSTANCE.
>>>for the resource...
>>>
>>>How does the DLL get the HINSTANCE of itself ?
>>
>>
>> Looking up DllMain should get you all the information you need.
>
> A more convenient, but less obvious way is this:
>
> HINSTANCE GetCurrentModule()
> {
> extern "C" char __ImageBase;
> return (HINSTANCE) &__ImageBase;
> }
>
> --
> Tim Robinson (MVP, Windows SDK)
> http://mobius.sourceforge.net/

thanks folks =]