需要在CStatic控件中加载视频

发布于 2024-11-26 01:16:13 字数 1129 浏览 0 评论 0原文

我需要将任何文件格式的视频加载到我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文