需要在CStatic控件中加载视频
我需要将任何文件格式的视频加载到我的 MFC 应用程序的 CStatic 控件中,我在网上学习时编写了代码来加载它。代码片段如下。但这不起作用。有什么想法吗?
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;
}
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论