CComPtr<IWMPCore> m_spWMPPlayer;
hr = spElemDisp.QueryInterface(&m_spWMPPlayer);
if (m_spWMPPlayer!=NULL&&SUCCEEDED(hr))
{CComPtr<IConnectionPointContainer> spConnectionContainer;
CComPtr<IWMPEvents> spEventListener;
CComPtr<IConnectionPoint> m_spConnectionPoint;
DWORD dwCookie;
m_spWMPPlayer->QueryInterface(&spConnectionContainer);
// hr = m_spWMPPlayer->QueryInterface(&spConnectionContainer);
if (FAILED(hr))
{
MessageBox(0,0,0,0);
break;
}hr = spConnectionContainer->FindConnectionPoint(__uuidof(IWMPEvents), &m_spConnectionPoint);
if (FAILED(hr))
{
MessageBox(0,"0.1",0,0);//会出现hr = spConnectionContainer->FindConnectionPoint(__uuidof(_WMPOCXEvents), &m_spConnectionPoint);
if (FAILED(hr))
{
MessageBox(0,"1",0,0);//会出现 TMD2个都失败了hr =E_NOINTERFACE
break;
}}
hr = m_spConnectionPoint->Advise(spEventListener, &dwCookie);
if (FAILED(hr))
{
MessageBox(0,"2",0,0);
break;
}CComPtr<IWMPCore> m_spWMPPlayer;可以修改属性,就是不能sink事件
hr = spElemDisp.QueryInterface(&m_spWMPPlayer);
if (m_spWMPPlayer!=NULL&&SUCCEEDED(hr))
{CComPtr<IConnectionPointContainer> spConnectionContainer;
CComPtr<IWMPEvents> spEventListener;
CComPtr<IConnectionPoint> m_spConnectionPoint;
DWORD dwCookie;
m_spWMPPlayer->QueryInterface(&spConnectionContainer);
// hr = m_spWMPPlayer->QueryInterface(&spConnectionContainer);
if (FAILED(hr))
{
MessageBox(0,0,0,0);
break;
}hr = spConnectionContainer->FindConnectionPoint(__uuidof(IWMPEvents), &m_spConnectionPoint);
if (FAILED(hr))
{
MessageBox(0,"0.1",0,0);//会出现hr = spConnectionContainer->FindConnectionPoint(__uuidof(_WMPOCXEvents), &m_spConnectionPoint);
if (FAILED(hr))
{
MessageBox(0,"1",0,0);//会出现 TMD2个都失败了hr =E_NOINTERFACE
break;
}}
hr = m_spConnectionPoint->Advise(spEventListener, &dwCookie);
if (FAILED(hr))
{
MessageBox(0,"2",0,0);
break;
}CComPtr<IWMPCore> m_spWMPPlayer;可以修改属性,就是不能sink事件
不存在版本问题吧
而且我属性什么的都可以改