LPCONNECTIONPOINTCONTAINER pCPCMy = NULL;
IConnectionPointPtr m_pConnectionPointMy;
if (FAILED(hr = pHTMLWindow-> QueryInterface(IID_IConnectionPointContainer, (LPVOID*)&pCPCMy)))
{
//goto Error;
} if (FAILED(hr = pCPCMy-> FindConnectionPoint(DIID_HTMLWindowEvents2, &m_pConnectionPointMy)))
{
//goto Error;
}
IUnknown* pUnk = m_pSink->GetInterface(&IID_IUnknown);
m_pConnectionPointMy->Advise(pUnk, &m_dwCookie);上面的 代码已经成功挂接到 HTML上去了
但是我是设置一个Timer来工作的
发现了页面就挂接 如果Timer一直不停的 工作
那就挂接了N次 事件就会相应N次
有没有办法查询事件已经被我挂接上去了 而且是正常工作的?
IConnectionPointPtr m_pConnectionPointMy;
if (FAILED(hr = pHTMLWindow-> QueryInterface(IID_IConnectionPointContainer, (LPVOID*)&pCPCMy)))
{
//goto Error;
} if (FAILED(hr = pCPCMy-> FindConnectionPoint(DIID_HTMLWindowEvents2, &m_pConnectionPointMy)))
{
//goto Error;
}
IUnknown* pUnk = m_pSink->GetInterface(&IID_IUnknown);
m_pConnectionPointMy->Advise(pUnk, &m_dwCookie);上面的 代码已经成功挂接到 HTML上去了
但是我是设置一个Timer来工作的
发现了页面就挂接 如果Timer一直不停的 工作
那就挂接了N次 事件就会相应N次
有没有办法查询事件已经被我挂接上去了 而且是正常工作的?
m_dwCookie有值了就不用再Advise了。