作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 Javascript 单击 webbrowser 控件中的链接。但我不想听到 IE 的“咔嗒”声。
有没有办法做到这一点?
附言
Document.Write
不是我的选择。 最佳答案
对于 IE7 及以上,你可以使用这个:
int feature = FEATURE_DISABLE_NAVIGATION_SOUNDS;
CoInternetSetFeatureEnabled(feature, SET_FEATURE_ON_PROCESS, true);
private const int FEATURE_DISABLE_NAVIGATION_SOUNDS = 21;
private const int SET_FEATURE_ON_THREAD = 0x00000001;
private const int SET_FEATURE_ON_PROCESS = 0x00000002;
private const int SET_FEATURE_IN_REGISTRY = 0x00000004;
private const int SET_FEATURE_ON_THREAD_LOCALMACHINE = 0x00000008;
private const int SET_FEATURE_ON_THREAD_INTRANET = 0x00000010;
private const int SET_FEATURE_ON_THREAD_TRUSTED = 0x00000020;
private const int SET_FEATURE_ON_THREAD_INTERNET = 0x00000040;
private const int SET_FEATURE_ON_THREAD_RESTRICTED = 0x00000080;
...
[DllImport("urlmon.dll")]
[PreserveSig]
[return:MarshalAs(UnmanagedType.Error)]
static extern int CoInternetSetFeatureEnabled(
int FeatureEntry,
[MarshalAs(UnmanagedType.U4)] int dwFlags,
bool fEnable);
关于.net - 如何在 WebBrowser Control 中禁用点击声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/393166/
我是一名优秀的程序员,十分优秀!