Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ICaptureGraphBuilder2::GetFiltergraph return E_UNEXPECTED,why?

14 views
Skip to first unread message

cgq130

unread,
Mar 4, 2010, 2:21:01 AM3/4/10
to
Code:
IGraphBuilder* gb;
ICaptureGraphBuilder2* cgb2;
HRESULT hr=0;
if(FAILED(CoInitialize(NULL)))
return hr;
if(FAILED(hr=CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,IID_IGraphBuilder,(LPVOID*)&gb)))
return hr;
if(FAILED(hr=CoCreateInstance(CLSID_CaptureGraphBuilder2,NULL,CLSCTX_INPROC,IID_ICaptureGraphBuilder2,(LPVOID*)&cgb2)))
return hr;
if(FAILED(hr=cgb2->GetFiltergraph(&gb)))
return hr; //hr==E_UNEXPECTED


if the code CComPtr<IGraphBuilder> gb;CComPtr<ICaptureGraphBuilder2> cgb2;
instead of IGraphBuilder* gb;ICaptureGraphBuilder2* cgb2;
the program run stop in the code if(FAILED(hr=cgb2->GetFiltergraph(&gb)))
and throw a dialog.

the information of dialog:

Debug Assertion Failed!
Program:f:\capt\capt.exe
File:d:\vs2008\vc\atlmfc\include\altcomcli.h
Line: 149

Expression:p==0

For information on how your program can cause an assertion failure, see the
Visual C++ documentation on asserts.

(Press Retry to debug the application)

What's wrong with this program?How to correct?

0 new messages