屏蔽webBrowser右键
2004-08-08 22:54
357 查看
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;
}
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;
}
相关文章推荐
- ATL实现Connection Point的一种简单的方法
- javascript表单之间的数据传递!
- DirectX.Capture
- 使用C#开发COM+组件
- 纯编码实现数据库的建立或压缩
- 从数据库中动态选取下拉列表的方法
- 用ASP备份数据库
- thinking in c++ 卷2
- thinking in c++卷2
- thinkng in c++卷2
- log4j使用示例
- Red Hat Linux 7.2汉化
- 面向对象语言基础 一
- Pragmatic Unit Testing in Java with JUnit 书评
- 从java线程中获得运算结果
- 翻译Sun帮助文件——javax.wireless.messaging(MessageListener)
- 安装求救
- 文件上传的一点心得
- 让应用程序禁止Windows屏幕保护
- 2014年软考数据库系统工程师知识点讲解(1)