UINT nMsg=: : RegisterWindowMessage (_T (" WM_HTML_GETOBJECT "));
LRESULT lRes.
: : SendMessageTimeout (hWnd, nMsg, 0 l, 0 l, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) & amp; LRes);
CComPtr
Retrieves the hr=: : ObjectFromLresult (lRes IID_IHTMLDocument2, 0, (void * *) & amp; PHTMLDocument2);
//the code must be normal circulation call browser can respond to events or jammed
if (! M_bIsBindEvent)
{
CComPtr
Hr=pHTMLDocument2 - & gt; (IHTMLWindow2 get_parentWindow (* *) & amp; PHTMLWindow2);
CComPtr
SpServiceProv=NULL;
Hr=pHTMLWindow2 - & gt; QueryInterface (IID_IServiceProvider, (void * *) & amp; SpServiceProv);
CComPtrHr=spServiceProv - & gt; QueryService (SID_SWebBrowserApp IID_IWebBrowser2, (void * *) & amp; PWebBrowser2);
CComPtr PCPC;
PWebBrowser2 - & gt; QueryInterface (IID_IConnectionPointContainer, (void * *) & amp; PCPC);
PCPC - & gt; FindConnectionPoint (DIID_DWebBrowserEvents2, & amp; M_pCP);
If (NULL==m_pEventListener)
M_pEventListener=new IEEvent;
Hr=m_pCP - & gt; Advise (IUnknown (*) (void *) m_pEventListener, & amp; M_dwCookie);
M_bIsBindEvent=true;
}
Help to IE binding DWebBrowserEvents2 events need to be continually call: : ObjectFromLresult browser can run normally or browser jammed someone know why CodePudding user response:
I don't know anyway,
Maybe baidu knows, CodePudding user response: