Link to home
Start Free TrialLog in
Avatar of The Master
The Master

asked on

Retrieving HINSTANCE

What's the easiest way to programatically obtain the HINSTANCE of the current app?

Some restraints:

1.  I'm writing a small little class that I want to be able to reuse, so I don't want to rely on a global variable.  

2.  I'm also trying to keep some APIs consistent, so I don't want to require the handle as a function or constructor parameter.  

3.  It's not MFC, so AfxGetInstanceHandle() is out of the question.

4.  I don't have a main window handle, so I can't use GetWindowLong().

I need the instance handle in order to call DialogBoxIndirectParam().  Is there another way to get around this?  I know I've figured this out before, but now I'm blanking and getting frustrated.  Anyone know this offhand?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of The Master
The Master

ASKER


Doh...of course!  Argh....

Thanks!