如何在MFC中显示Directshow C ++预览 [英] how to display Directshow C++ preview in MFC

查看:47
本文介绍了如何在MFC中显示Directshow C ++预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


有人知道如何在mfc中有一个窗口来显示avi文件或网络摄像头预览吗?

我尝试在MFC中使用静态文本(staticScreen),例如:

Hi,
Any one know how to have a window in mfc to display an avi file or web-cam preview?

I try to use a stastic text (staticScreen)in MFC like:

//-----------------in .h

IVideoWindow *m_pVideoWindow; CStatic m_staticScreen;
// also some code in dodataexchange...
//-----------------in .cpp

HWND m_ScreenhWnd = m_staticScreen.GetSafeHwnd() ;
hr=pGraphBuilder->QueryInterface(IID_IVideoWindow,(LPVOID*) m_pVideoWindow);

m_pVideoWindow->put_Visible(OAFALSE);

hr=m_pVideoWindow->put_Owner((OAHWND)m_pVideoWindow);

//m_pVideoWindow->put_Owner(NULL);

hr=m_pVideoWindow->put_WindowStyle(WS_CHILD|WS_CLIPCHILDREN);


当我将put_owner放入nullput_owner放入m_hWnd
时,它可以工作 但是当我put_ownerm_ScreenhWnd时,我可以看到那里的东西,但是静态窗口不会自动更新.因此,如果有一些与此静态控件相关的事件,我就很伤心.还是我应该为禁用查找其他控件?


It works when I put_owner to null or put_owner to m_hWnd
but when I put_owner to m_ScreenhWnd, I can see somthing there, but the static window will not automatically update. So I wounder if there are some events related to this static control. Or should I just looking for other control for the disable?

推荐答案

这可能有帮助:
具有VISUAL C ++ MFC的网络摄像头 [ ^ ]

如果还不够,请几个可选答案 [
This may help:
Webcam with VISUAL C++ MFC[^]

If that''s not enough here is a few optional answers[^]

Regards
Espen Harlinn


哈林

感谢你的信息.这些对我有很大帮助.现在,在我的程序中,我将仅使用IVideoWindow,它可以正常工作.
Hi, Harlinn

Thanks for your information. Those help me a lot. Now in my program I will make use IVideoWindow only, and it works fine.


这篇关于如何在MFC中显示Directshow C ++预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆