Public Delegate Void DHTMLEVENT (IHTMLVENTOBJ E);
public class DHTMLEventHandler {public DHTMLEvent Handler; HTMLDocument Document; public DHTMLEventHandler (HTMLDocument doc) {this.Document = doc;} public void Call () {Handler (Document.parentWindow @ event.);}}
private void axWebBrowser1_DocumentComplete (object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e) {HTMLDocument doc = this.axWebBrowser1.Document as HTMLDocument; DHTMLEventHandler Handler = new DHTMLEventHandler (doc); Handler.Handler = new DHTMLEvent (this.Browser_ContextMenuStandardEvent); doc.oncontextmenu = Handler;
Private void browser_contextMenustAndardEvent (mshtml.ihtmleventobj e) {messagebox.show ("Context Menu Action (Event Object) Hooked"; E.RETURNVALUE = false;}