19,502
社区成员
发帖
与我相关
我的任务
分享
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 );
}