Re: HMODULE from HINSTANCE
// You are right. You can't get HMODULE from HINSTANCE without hardcode of the dll name. See this below
// I think as you that this is the only way
HINSTANCE hInstance = LoadLibrary("dllname"); // Mapping module to memory
HMODULE hModule = GetModuleHandle("dllname"); // Getting module handle
// If you ever understand any more easy way of this write me please to [email protected].
// Thanks.
Re: HMODULE from HINSTANCE
Well, I must have done something stupid this morning, because I can apparently use the HINSTANCE in the HMODULE parameter of FindResource(). I don't know if they are equivalent everywhere or not, but you might try using one for the other. I get my HINSTANCE parameter from the dll initialization function (I save it in a static variable and then extern it for future reference.)
Re: HMODULE from HINSTANCE
An HMODULE and an HINSTANCE are the same thing and you can use them interchangeably.
For example, if you look at the startup code in the standard library, the hInstance that get's passed to WinMain is obtained with GetModuleHandle(NULL);
The universe is a figment of its own imagination.