Solved

The video window in wrong location when playing video

Posted on 2009-04-07
1
485 Views
Last Modified: 2013-12-21
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
Comment
1 Comment
 

Accepted Solution

by:
Mingfeng(明峰) Zhu(朱) earned 0 total points
ID: 24107814
Don't need to solve this problem now. How can I close out it? Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
triangle challenge 4 117
Dell Laptop M6800 6 72
BXR1220 speakers- does not work on another PC 12 46
Way to decrease size of apk file 9 40
Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
Let me explain this picture a little bit.  First, in case you haven't already guessed, you are looking at my 2 phones, an Android Samsung Galaxy S5 on the left and an iPhone 5 on the right.  They are on their respective cradles on my desk.  But, you…
Viewers will learn key ranges in Sampler to make their sampled instruments sound more realistic Gather samples of various notes and drag them to Key Range panel: Set proper root key for each sample: Select all the samples with Command-A (or Ctrl…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now