I'm not sure if I'm just imagining things but is this right?
Code:HINSTANCE hinstDLL_; myClass myInstance( _hinstDLL );
I'm not sure if I'm just imagining things but is this right?
Code:HINSTANCE hinstDLL_; myClass myInstance( _hinstDLL );
★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★
That was the only bit I typed out rather than copying & pasting, and I messed it up. The code actually reads
If I do the following, it works perfectly. But I'd rather not hardcode the filename.Code:myClass myInstance( hinstDLL_ );
Code:myClass myInstance( GetModuleHandle("myfile.dll") );
GetModuleHandleEx
Code:HMODULE GetCurrentModuleHandle() { HMODULE hMod = NULL; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, reinterpret_cast<LPCWSTR>(&GetCurrentModuleHandle), &hMod); return hMod; }
Thanks adeyblue. Currently my application runs on Win95+ (other than GetLastError which is 2k+), I'm not keen to introduce dependencies on this newer stuff unless I have to.
Can you think of any other options? I'm still unsure why passing hinstDLL from dllMain isn't working.