Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

The video window in wrong location when playing video

I try to play video with direct show under WinCE 5.0 OS

my problem as below:
1) my step: I first create an interface "IGraphBuilder", then query "IVideoWindow" with it, after render a file, set the IVideoWindow owner to a dialog, set its style as "WS_CHILD| WS_CLIPSIBLINGS", finally start the play.
actual result:
a) the video play window is not the child window of my pointed dialog, the video window is a seperate window (it can be seen on wince task bar)
b) when the dialog pop up and show, the Video windos is minimized.

2) my application will paint the dialog client rect on time, how can I avoid the re-paint the video window, Is there any parameters can be set for video window (like always set it to top)?

Besides, almost same code under windowXP is OK.
my mfc application is dialog based.

        hr = m_pGraph->RenderFile(str_filename,NULL);
	if(FAILED(hr))
	{
		AfxMessageBox(TEXT("can not open the fail"));
		return FALSE;
	}
 
	//////////////////////////////////////////////////////////////
	// set vidio window owner and window position
	hr = m_pVidWin->put_Owner((OAHWND) (this->GetSafeHwnd()) );
	if (SUCCEEDED(hr))
	{
		// The video window must have the WS_CHILD style
		hr = m_pVidWin->put_WindowStyle( WS_POPUP | WS_BORDER  );
		if(FAILED(hr))
		{
			AfxMessageBox(TEXT("put_WindowStyle \"WS_CHILD | WS_CLIPSIBLINGS\" fail"));
		}
		// Read coordinates of video container window
		RECT rc;
		this->GetClientRect(&rc);
		long width =  rc.right - rc.left;
		long height = rc.bottom - rc.top - 50;
 
		// Ignore the video's original size and stretch to fit bounding rectangle
		hr = m_pVidWin->SetWindowPosition(rc.left, rc.top, width, height);
		if(FAILED(hr))
		{
			AfxMessageBox(TEXT("m_pVidWin SetWindowPosition fail"));
			return FALSE;
		}
	} else 
	{
		AfxMessageBox(TEXT("put_Owner fail"));
		return FALSE;
	}
 
	// let window visible
	hr = m_pVidWin->put_Visible(OATRUE);
	if(FAILED(hr))
	{
		AfxMessageBox( _T("put_Visible: OATRUE fail"));
	}
	
	// start play !!!
	hr = m_pControl->Run();
	if(FAILED(hr))
	{
		CString errmsg;
		errmsg = _T("play video") + str_filename + _T("fail");
		AfxMessageBox( errmsg );
	}

Open in new window

0
Mingfeng(明峰) Zhu(朱)
Asked:
Mingfeng(明峰) Zhu(朱)
1 Solution
 
Mingfeng(明峰) Zhu(朱)Author Commented:
Don't need to solve this problem now. How can I close out it? Thank you.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now