描述:
1、关于RegisterDeviceNotification这个函数,包含了windows.h头文件,仍然编译失败,总说是undeclared identifier。
2、程序在debug时,有一些信息看不懂。不明白是什么意思,哪里出了错。
1)kswdmcap.ax(tid 25c) 278 : CVideo1DataTypeHandler, DEST SIZE FAILED
2)Direct3D8: (ERROR) :Motion comp interface not supported
3)ksproxy.ax(tid 278) 12967 : StreamSegment 003cf820 failed
4)The thread 0x488 has exited with code -2147024637 (0x80070103).
3)关闭摄像机后,会收到WM_GRAPHNOTIFY消息,处理函数如下:
// .H file
CComPtr<IGraphBuilder> m_pGraph;
CComPtr<ISampleGrabber> m_pGrabber;
CComPtr<IBaseFilter> m_pDeviceFilter;
// .CPP file
CComQIPtr<IMediaControl, &IID_IMediaControl> pCtrl = m_pGraph;
if (pCtrl)
pCtrl->Stop();
CComQIPtr<IVideoWindow, &IID_IVideoWindow> pWnd = m_pGraph;
if (pWnd)
{
pWnd->put_Visible(OAFALSE);
pWnd->put_Owner(NULL);
}
CComQIPtr<IMediaEventEx, &IID_IMediaEventEx> pEvent = m_pGraph;
pEvent->SetNotifyWindow(NULL, 0, 0);
SAFE_RELEASE(m_pGrabber);
SAFE_RELEASE(m_pDeviceFilter);
SAFE_RELEASE(m_pGraph);
运行时,到stop()就出错了,出错信息是“SUCCEEDED(hr) At line 2520 of d:\xpclient\multimedia\dshow\filters\core\filgraph\filgraph\filgraph.cpp”。如果注释掉pCtrl->Stop(),则到最后也会出错,出错信息是“0 At line 10178 of d:\xpclient\multimedia\dshow\filter.ks\ksproxy\ksutil.cpp”。通过Context可以看到是停在了
~CComQIPtr()
{
if (p)
-> p->Release();
}
这是什么原因呢?要怎么解决?
解决方案1:
你用的是vc6吧,这个note的意思是说当你用的头文件发布时,nt5.0和windows98beta版本是当前的版本,你只能编译beta版本或测试版本的程序,我估计是的vc或者是platform sdk版本太老了,下载一个新的platform sdk或者用vc.net吧。
解决方案2: 呵呵,
改成
#undef WINVER
#define WINVER 0x0500
或者在stdafx.h中
如果是
#ifndef WINVER // 允许使用 Windows 95 和 Windows NT 4 或更高版本的特定功能。
#define WINVER 0x0400 //为 Windows 2000 及更新版本改变为适当的值。
#endif
则把WINVER 改成0x0500啊
还有你的智能指针怎么没有调用CoCreateInstance
再包含windows.h头文件前,定义(改变)一下windows的版本。默认的0x400是不行的。
职能指针不熟悉,没有建议。