ATL DLL Newbie Question
-
Hey Guys, I'm trying to port a plain WIN32 dll over to another system which uses ATL to implement the interface. I know nothing about ATL but I've sort of got it working aside from the fact I can't figure out how to get the HINSTANCE of my DLL. The DLLmain does the following
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_My_Plugin, CMyPlugin)
END_OBJECT_MAP()BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE; // ok
}I can see the _Module gets the HINSTANCE here but how do I get to it from the
CMyPlugin
class? Cheers James -
Hey Guys, I'm trying to port a plain WIN32 dll over to another system which uses ATL to implement the interface. I know nothing about ATL but I've sort of got it working aside from the fact I can't figure out how to get the HINSTANCE of my DLL. The DLLmain does the following
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_My_Plugin, CMyPlugin)
END_OBJECT_MAP()BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE; // ok
}I can see the _Module gets the HINSTANCE here but how do I get to it from the
CMyPlugin
class? Cheers James_Module.GetModuleInstance();)
-
_Module.GetModuleInstance();)
:-O Thanks. Didn't realise it was that straightforward. Cheers James