private void _browser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e) { mshtml.HTMLDocumentEvents2_Event doc = ((mshtml.HTMLDocumentEvents2_Event)_browser.Document); doc.onmousedown += new HTMLDocumentEvents2_onmousedownEventHandler(doc_UserAction); doc.onmousemove += new HTMLDocumentEvents2_onmousemoveEventHandler(doc_UserAction); doc.onclick += new HTMLDocumentEvents2_onclickEventHandler(doc_UserClickAction); doc.onmousewheel += new HTMLDocumentEvents2_onmousewheelEventHandler(doc_UserClickAction); UpdateButtons(); }
private void wrapEvents(IHTMLDocument2 docItem) { mshtml.HTMLDocumentEvents2_Event iEvent = null; //if (typeof(mshtml.HTMLDocumentEvents2_Event).IsAssignableFrom(typeof(HTMLDocument))) iEvent = (mshtml.HTMLDocumentEvents2_Event)docItem; if (iEvent != null) { try { iEvent.onclick -= new mshtml.HTMLDocumentEvents2_onclickEventHandler(OnBodyItemClick); } catch (Exception ex) { string errorMsg = ex.Message; } iEvent.onclick += new mshtml.HTMLDocumentEvents2_onclickEventHandler(OnBodyItemClick); } }