My module is a filter to work with DirectShow. Now i used
::GetModuleInstance(sMyModuleFileName), it fixed my problem.
"Duy Trinh" <duy.trinh@mobinex.com> ha scritto nel messaggio
news:%23LHFWqk3HHA.2064@TK2MSFTNGP03.phx.gbl...
Hi all
i try to load a bitmap from resource in COm and dll.
hInstance = NULL;// i can't get instance
LoadBitmap(hInstance, ID_BITMAP1)
Hi,
I don't know if I have understood your question well...
However: when a DLL is loaded into a process, the DllMain function is
called with dwReason == DLL_PROCESS_ATTACH, and the DLL hInstance is
specified as input parameter to DllMain.
So, you can store the DLL instance like so:
<code>
BOOL WINAPI DllMain(
HINSTANCE hInstance,
DWORD dwReason,
LPVOID lpvReserded )
{
switch ( dwReason )
{
case DLL_PROCESS_ATTACH:
{
// Save DLL instance handle
g_dllInstance = hInstance;
break;
}
...
}
return TRUE;
}
</code>
If you use ATL, you might use CComModule::GetModuleInstance (or use
CAtlBaseModule, if you are developing using ATL 7).
Giovanni