Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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:
C++
//-----------------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);

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?
Posted
Updated 13-Mar-11 1:29am
v5

This may help:
Webcam with VISUAL C++ MFC[^]

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

Regards
Espen Harlinn
 
Share this answer
 
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900