Web浏览器禁用右键单击 [英] Web Browser Disable Right Click

查看:96
本文介绍了Web浏览器禁用右键单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我敢肯定,由于它有用,一定要被问过一百万次,

但是有没有在Web浏览器控件上禁用右键单击(以及其他

服务,如Ctrl + P,浏览器热键等)的任何合理解决方案

VB.NET?


尽管现在谷歌搜索和关闭一周的想法,我只找到一个

解决方案,这是在窗体上实现IMessageFilter然后陷阱

所有传入的消息。不幸的是,这也阻止了用户能够移动我的应用程序(与捕获正确的

点击有关),以及其他有用的东西,如能够使用退格

键!


有没有其他方法可以做到这一点?或者是否有某种方法可以捕获

消息,这些消息在处理它们之前进入Web浏览器控件并且

我的表单之后?当然有人必须想出一个有效的方式

在.NET WinForm中托管自定义浏览器!


TIA

Alex Clark

解决方案

不知道这是否有任何帮助,但在VB世界中,

Microsoft提供的WbCustomizer控件可用于

禁止任何上下文菜单和/或速度键(全部或个人)。

WbCustomizer提供了soource代码(它是一个c ++项目)。鉴于它带有来源的
,也许可以修改为在

DotNet环境下工作。


" Alex克拉克" <人** @ theclarkhome.SPAMTIN.net>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...

大家好,

我敢肯定,由于它的实用性,它必须被问过一百万次,
但有没有任何合理的解决方案来禁用右键单击(和其他 VB.NET中的Web浏览器控件上的诸如Ctrl + P,浏览器热键等服务?

尽管现在谷歌搜索和关闭一周的想法,我只发现一个
解决方案,这是在窗体上实现IMessageFilter然后
陷阱所有传入的消息。不幸的是,这也阻止了用户
能够移动我的应用程序(与捕获正确的点击次数有关),以及其他有用的东西,比如能够使用
退格键!

有没有其他方法可以做到这一点?或者是否有某些方法可以在处理它们之前捕获进入Web浏览器控件的消息并且
在我的表单之后?当然有人必须想出一种有效的
方式在.NET WinForm中托管自定义浏览器!

TIA
Alex Clark



不知道这是否有任何帮助,但在VB世界中,可以使用Microsoft提供的

WbCustomizer控件

禁止任何上下文菜单和/或速度键(全部或个人)。

WbCustomizer提供了soource代码(它是一个c ++项目)。鉴于它带有来源的
,也许可以修改为在

DotNet环境下工作。


" Alex克拉克" <人** @ theclarkhome.SPAMTIN.net>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...

大家好,

我敢肯定,由于它的实用性,它必须被问过一百万次,
但有没有任何合理的解决方案来禁用右键单击(和其他 VB.NET中的Web浏览器控件上的诸如Ctrl + P,浏览器热键等服务?

尽管现在谷歌搜索和关闭一周的想法,我只发现一个
解决方案,这是在窗体上实现IMessageFilter然后
陷阱所有传入的消息。不幸的是,这也阻止了用户
能够移动我的应用程序(与捕获正确的点击次数有关),以及其他有用的东西,比如能够使用
退格键!

有没有其他方法可以做到这一点?或者是否有某些方法可以在处理它们之前捕获进入Web浏览器控件的消息并且
在我的表单之后?当然有人必须想出一种有效的
方式在.NET WinForm中托管自定义浏览器!

TIA
Alex Clark



< body oncontextmenu ="返回false;">


有更复杂的方法可以从.NET中执行此操作,但这总是对我来说很好。/ b $ b工作正常。


好​​吧,这有助于它的一部分...


Jay Feldman


" Alex Clark"写道:

大家好,

我敢肯定,由于它的实用性,它必须被问过一百万次,
但是在VB.NET中的Web浏览器控件上是否有任何合理的解决方案可以禁用右键单击(以及其他
服务,如Ctrl + P,浏览器热键等)?
尽管现在谷歌搜索和关闭一个星期的想法,我只找到一个
解决方案,这是在表单上实现IMessageFilter然后陷阱所有传入的消息。不幸的是,这也阻止了用户能够移动我的应用程序(与捕获正确的点击有关),以及其他有用的东西,比如能够使用退格键!

有没有其他方法可以做到这一点?或者是否有某些方法可以在处理它们之前捕获进入Web浏览器控件的消息并且
在我的表单之后?当然有人必须想出一种在.NET WinForm中托管自定义浏览器的有效方法!

TIA
Alex Clark



Hi All,

I''m sure this must have been asked a million times due to it''s usefulness,
but are there any sensible solutions for disabling right click (and other
services such as Ctrl+P, Browser hotkeys etc) on a Web-Browser control in
VB.NET?

Despite Googling for ideas on and off for a week now, I only found one
solution and this was to implement IMessageFilter on the form and then trap
all the incoming messages. Unfortunately, this also prevents the user from
being able to move my application (something to do with trapping right
clicks), along with other useful things like being able to use the backspace
key!

Is there any other way of doing this? Or is there some way I can trap
messages that go into the Web-browser control BEFORE it processes them and
AFTER my Form has? Surely somebody must have come up with an efficient way
of hosting a customized browser in a .NET WinForm!

TIA
Alex Clark

解决方案

Don''t know if this would be of any help, but in the VB world, the
WbCustomizer control that Microsoft made available could be used to
suppress any the context menu and/or speed keys (all or individual). The
WbCustomizer was provided with soource code (it was a c++ project). Given
that it came with source, perhaps that could be modified to work under the
DotNet environment.

"Alex Clark" <al**@theclarkhome.SPAMTIN.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

Hi All,

I''m sure this must have been asked a million times due to it''s usefulness,
but are there any sensible solutions for disabling right click (and other
services such as Ctrl+P, Browser hotkeys etc) on a Web-Browser control in
VB.NET?

Despite Googling for ideas on and off for a week now, I only found one
solution and this was to implement IMessageFilter on the form and then trap all the incoming messages. Unfortunately, this also prevents the user from being able to move my application (something to do with trapping right
clicks), along with other useful things like being able to use the backspace key!

Is there any other way of doing this? Or is there some way I can trap
messages that go into the Web-browser control BEFORE it processes them and
AFTER my Form has? Surely somebody must have come up with an efficient way of hosting a customized browser in a .NET WinForm!

TIA
Alex Clark



Don''t know if this would be of any help, but in the VB world, the
WbCustomizer control that Microsoft made available could be used to
suppress any the context menu and/or speed keys (all or individual). The
WbCustomizer was provided with soource code (it was a c++ project). Given
that it came with source, perhaps that could be modified to work under the
DotNet environment.

"Alex Clark" <al**@theclarkhome.SPAMTIN.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

Hi All,

I''m sure this must have been asked a million times due to it''s usefulness,
but are there any sensible solutions for disabling right click (and other
services such as Ctrl+P, Browser hotkeys etc) on a Web-Browser control in
VB.NET?

Despite Googling for ideas on and off for a week now, I only found one
solution and this was to implement IMessageFilter on the form and then trap all the incoming messages. Unfortunately, this also prevents the user from being able to move my application (something to do with trapping right
clicks), along with other useful things like being able to use the backspace key!

Is there any other way of doing this? Or is there some way I can trap
messages that go into the Web-browser control BEFORE it processes them and
AFTER my Form has? Surely somebody must have come up with an efficient way of hosting a customized browser in a .NET WinForm!

TIA
Alex Clark



one easy way to block the right click is to put this code into the html page

<body oncontextmenu="Return false;">

there are more complicated ways of doing it from .NET, but this hasa always
worked fine for me.

well, this helps part of it...

Jay Feldman

"Alex Clark" wrote:

Hi All,

I''m sure this must have been asked a million times due to it''s usefulness,
but are there any sensible solutions for disabling right click (and other
services such as Ctrl+P, Browser hotkeys etc) on a Web-Browser control in
VB.NET?

Despite Googling for ideas on and off for a week now, I only found one
solution and this was to implement IMessageFilter on the form and then trap
all the incoming messages. Unfortunately, this also prevents the user from
being able to move my application (something to do with trapping right
clicks), along with other useful things like being able to use the backspace
key!

Is there any other way of doing this? Or is there some way I can trap
messages that go into the Web-browser control BEFORE it processes them and
AFTER my Form has? Surely somebody must have come up with an efficient way
of hosting a customized browser in a .NET WinForm!

TIA
Alex Clark



这篇关于Web浏览器禁用右键单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆