Thursday, September 25, 2014

Odd HINSTANCE

Being called from DLL module, guess, which one would give you odd result?

HINSTANCE h1 = AfxGetInstanceHandle();
HINSTANCE  h2 = GetModuleHandle(NULL);
HINSTANCE h3 = AfxGetApp()->m_hInstance;
HINSTANCE h4 = theApp.m_hInstance;



Here is answer in numbes
h1    0x05d10000
h2    0x00400000 - gives you HMODULE of EXE, even being called from DLL
h3    0x05d10000
h4    0x05d10000

No comments:

Post a Comment