public delegate void DHTMLEvent(IHTMLEventObj 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;
}