I need load a video of any file format into a CStatic control for my MFC application I have written the code as I studied from web to load it. The Code snippet is given below. But it doesn't work. Any idea about it?
LRESULT SIMTankConfigureWindowDlg::OnFinishedFrame(WPARAM wParam, LPARAM lParam)
{
HRESULT hr = S_OK;
if(m_bFinishIntroMovie)
{
m_pGraph->play();
}
else
{
//
//SAFE_DELETE(m_pGraph);
m_bFinishIntroMovie = true;
m_staticMovieCanvas.ShowWindow(0);
m_staticMovieCanvas.MoveWindow(310,52, 345, 167);
m_pGraph->setSizeDisplayWindow(CSize(345, 167));
//
CString str;
str = m_strCurrentDirName + "\\" + _T("T-59Tank.mpg");
LPWSTR lpszW = new WCHAR[开发者_如何转开发255];
LPTSTR lpStr = str.GetBuffer( str.GetLength() );
int nLen = MultiByteToWideChar(CP_ACP, 0,lpStr, -1, NULL, NULL);
MultiByteToWideChar(CP_ACP, 0, lpStr, -1, lpszW, nLen);
//
hr = m_pGraph->openFile(lpszW, 0);
if(SUCCEEDED(m_pGraph->play()))
{
//
m_staticMovieCanvas.ShowWindow(1);
}
delete[] lpszW;
}
return hr;
}
精彩评论