Can't register custom filter."g_hInst != 0 ..."
- I tried to write my own filter. When i tried to register it, I got this message.
g_hInst != 0
At line 387 of D:\Program Files\DXSDK\Samples\C++\DirectShow\BaseClasses\dllsetup.cpp
Comtinue?
Anyone can tell me why this happens?
this is my code maybe related.
//////////////////////////////////////////////////////////////////////////////
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL WINAPI DllEntryPoint(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);
}
STDAPI DllRegisterServer()
{
return AMovieDllRegisterServer2( TRUE );
}
STDAPI DllUnregisterServer()
{
return AMovieDllRegisterServer2( FALSE );
}
Answers
Shouldn't that be:
Code Snippetextern
"C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);BOOL WINAPI DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved)
{
return DllEntryPoint(reinterpret_cast<HINSTANCE>(hDllHandle), dwReason, lpReserved);}
Your DllEntryPoint is calling itself? The official DllEntryPoint() is in the baseclasses and calls _DllEntryPoint() in the same module that initializes the CRT.
Either implement DllMain() as your entry point or change the entry point for the DLL to DllEntryPoint() and remove your implementation.
All Replies
Shouldn't that be:
Code Snippetextern
"C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);BOOL WINAPI DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved)
{
return DllEntryPoint(reinterpret_cast<HINSTANCE>(hDllHandle), dwReason, lpReserved);}
Your DllEntryPoint is calling itself? The official DllEntryPoint() is in the baseclasses and calls _DllEntryPoint() in the same module that initializes the CRT.
Either implement DllMain() as your entry point or change the entry point for the DLL to DllEntryPoint() and remove your implementation.
- Thank you Chris P.!
- Hi Chris,
unfortunately, that won't work for me either. If I implement DllEntryPoint, an error appears that DllEntryPoint was already declared (baseclasses). If I set "DllEntryPoint" as my entry point for my DLL, I get the error that DllEntryPoint is unresolved.
What's wrong?
Thank you
Edit:
Whoops! I used the debugging version of the baseclass library. Works fine now (no implementation or setting of the entry point necessary).
So, the registration works fine but for some reason I can't use the filter -> "The filter could not be created. Resources used by this filter may already be in use." Well, I'm not using that filter at the same time, that's for sure.
Code: 0x800401F9
Edit2:
Here's the solution
I forgot to mention that I use MFC, so the story with the entry point causes the problems.
Solved now!


