Juanma
May 25, 2007, 14:35:06
Hallo,
I am having some problems while trying to create an instance of MVMotionDetection filter. First say that I googled a lot before coming here, this is my last chance before going nuts.
I have a DLL written in C++(Visual Studio 2005) which I use to create GraphEdit graphs to test some video hardware. As far as I know, any filter which is listed in Graphedit can be instanced (using C++) using the CoCreateInstance in the following way. However, I tried to insert MV I/O Not filter and worked, now I am trying to insert the MV Motion Detection Filter and I get an hr which succeeds put the pointer returning the interface holds null. What am I doing wrong? (in Graphedit I can insert it)
Code used to insert it ->
<<
HRESULT hr = CoCreateInstance(CLSID_MVMotionDetection, 0, CLSCTX_INPROC_SERVER,
IID_IBaseFilter,
reinterpret_cast<void**>(&pF));
AfxMessageBox(L"Check whether succeeded or not ");
if (hr = REGDB_E_CLASSNOTREG)
{
AfxMessageBox(L"REGDB_E_CLASSNOTREG");
}
if (hr = CLASS_E_NOAGGREGATION)
{
AfxMessageBox(L"CLASS_E_NOAGGREGATION");
}
if (hr = E_NOINTERFACE)
{
AfxMessageBox(L"E_NOINTERFACE");
}
if (hr = S_OK)
{
AfxMessageBox(L"S_OK");
}
if (pF == NULL)
{
AfxMessageBox(L"Null pointer returned");
}
if (SUCCEEDED(hr))
{
AfxMessageBox(L"SUCCEEDED, now going to add filter");
hr = pGraph->AddFilter(pF, wszName);
}
>>
Then the output I get is:
-Check whether succeeded or not
-REGDB_E_CLASSNOTREG
-CLASS_E_NOAGGREGATION
-E_NOINTERFACE
-Null pointer returned
-SUCCEEDED, now going to add filter
So, how can it be that Succeeded(hr) reports a true when all this Errors are seen inside hr? And second and most important, then why the pointer does not holds the address of the IID_IBaseFilter interface of the MVMotionDetection Filter class instance??????
Please help!
Thanks a lot
I am having some problems while trying to create an instance of MVMotionDetection filter. First say that I googled a lot before coming here, this is my last chance before going nuts.
I have a DLL written in C++(Visual Studio 2005) which I use to create GraphEdit graphs to test some video hardware. As far as I know, any filter which is listed in Graphedit can be instanced (using C++) using the CoCreateInstance in the following way. However, I tried to insert MV I/O Not filter and worked, now I am trying to insert the MV Motion Detection Filter and I get an hr which succeeds put the pointer returning the interface holds null. What am I doing wrong? (in Graphedit I can insert it)
Code used to insert it ->
<<
HRESULT hr = CoCreateInstance(CLSID_MVMotionDetection, 0, CLSCTX_INPROC_SERVER,
IID_IBaseFilter,
reinterpret_cast<void**>(&pF));
AfxMessageBox(L"Check whether succeeded or not ");
if (hr = REGDB_E_CLASSNOTREG)
{
AfxMessageBox(L"REGDB_E_CLASSNOTREG");
}
if (hr = CLASS_E_NOAGGREGATION)
{
AfxMessageBox(L"CLASS_E_NOAGGREGATION");
}
if (hr = E_NOINTERFACE)
{
AfxMessageBox(L"E_NOINTERFACE");
}
if (hr = S_OK)
{
AfxMessageBox(L"S_OK");
}
if (pF == NULL)
{
AfxMessageBox(L"Null pointer returned");
}
if (SUCCEEDED(hr))
{
AfxMessageBox(L"SUCCEEDED, now going to add filter");
hr = pGraph->AddFilter(pF, wszName);
}
>>
Then the output I get is:
-Check whether succeeded or not
-REGDB_E_CLASSNOTREG
-CLASS_E_NOAGGREGATION
-E_NOINTERFACE
-Null pointer returned
-SUCCEEDED, now going to add filter
So, how can it be that Succeeded(hr) reports a true when all this Errors are seen inside hr? And second and most important, then why the pointer does not holds the address of the IID_IBaseFilter interface of the MVMotionDetection Filter class instance??????
Please help!
Thanks a lot