Help for initialize IBaseFilter  
Author Message
ali_ba82





PostPosted: Smart Devices Native C++ Development, Help for initialize IBaseFilter Top

In my application I have this initialization

CComPtr< ISampleGrabber > pGrabber;

pGrabber.CoCreateInstance( CLSID_SampleGrabber );

CComQIPtr <IBaseFilter > pGrabberBase ( pGrabber );

I need separete the last sentence in two: first declare the variable pGrabberBase in a sentence and later initialize pGrabberBase with pGrabber in other sentence.How can I do this

What do "CComQIPtr <IBaseFilter > pGrabberBase ( pGrabber );" do exactly



Smart Device Development9  
 
 
Alex Feinman





PostPosted: Smart Devices Native C++ Development, Help for initialize IBaseFilter Top

It's an equivalent of

CComPtr<IBaseFilter>pGrabberBase;
pGrabber.QueryInterface(&pGrabberBase);



 
 
EricShan





PostPosted: Smart Devices Native C++ Development, Help for initialize IBaseFilter Top

IBaseFilter * pGrabberBase = NULL;

if(pGrabber)
{
hr = pGrabber->QueryInterface(IID_IBaseFilter,(void **)&pGrabberBase);
}

if(hr!==S_OK||(NULL==pGrabberBase){//FAILED}

//do something

//release
pGrabberBase->release();