Posted on 2001-09-05
What's the easiest way to programatically obtain the HINSTANCE of the current app?
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?