我需要将任何文件格式的视频加载到我的MFC应用程序的CStatic控件中我已经编写了代码,因为我从Web上学习加载它。代码段如下所示。但它不起作用。有什么想法吗?
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;
}