遇到问题,第一次开WM5程序,在MFC中 加入 ActiveX for Media Player 这段代码如下,帮忙看看!
CAxWindow m_wndView;
CComPtr m_spWMPPlayer;
CComPtr spHost;
BOOL CDialog::OnInitDialog()
{
HWND m_hwndView = m_wndView.Create(m_hWnd, rcClient,
NULL,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(&spHost);
if (SUCCEEDED(hr)) {
hr = spHost->CreateControl(CComBSTR(_T("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0);
if (SUCCEEDED(hr)) {
hr = m_wndView.QueryControl(&m_spWMPPlayer);
}
}
m_wndView.SetActiveWindow();
if ( m_spWMPPlayer )
{
m_spWMPPlayer->put_enableContextMenu(true);
m_spWMPPlayer->put_fullScreen(true);
m_spWMPPlayer->put_uiMode( CComBSTR(_T("full")) );
}
}