在 IWebBrowser2 OLE 控件中禁用脚本调试? C++

发布于 2024-09-03 14:42:25 字数 391 浏览 12 评论 0原文

我有一个 IWebBrowser2,用于通过 .Navigate() 访问一些网页 当页面出现 js 错误时,我收到“语法错误”的警告框,因此我使用 .put_Silent(TRUE)。现在,我收到了“VS Just-In-Time Debugger:未处理的异常”警告

如何从我的代码中禁用所有脚本错误警告(包括 JIT 调试器) (我的意思是不修改真实的 IE 设置)

I have a IWebBrowser2 I use to visit some webpages with .Navigate()
When the page has a js error I got a warning box for "Syntax error", so I used .put_Silent(TRUE). And now I get a warning for "VS Just-In-Time Debugger: Unhandled exception" instead

How can I disable all the script error warnings (including JIT debugger) from my code (i mean without modifying the real IE settings)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随波逐流 2024-09-10 14:42:25

您可以通过覆盖控制脚本调试的注册表设置来禁用脚本调试。正确的方法是实现 IDocHostUIHandler 接口,特别是 IDocHostUIHandler: :GetOptionKeyPathIDocHostUIHandler::GetOverrideKeyPath方法。使用 GetOptionKeyPath 忽略所有用户的 IE 设置(例如,字体大小)并使用 IE 默认值,或使用 GetOverrideKeyPath 使用大多数用户的 IE 设置但覆盖一些特定的设置。

上面链接的 MSDN 文章包含有关如何使用此接口的良好文档,以及 IDocHostUIHandler 接口及其方法的示例实现。

假设您的 GetOptionKeyPath 方法返回“SOFTWARE\MyCompany\MyApp\IE” 作为新的注册表路径。要确保禁用脚本调试,您需要创建 HKEY_CURRENT_USER\Software\MyCompany\MyApp\IE\Main 注册表项,然后创建一个名为 Disable Script Debugger 的字符串值> 值为yes

You can disable script debugging by overriding the registry settings that control it. The correct way to do this is to implement the IDocHostUIHandler interface, and specifically the IDocHostUIHandler::GetOptionKeyPath or IDocHostUIHandler::GetOverrideKeyPath methods. Use GetOptionKeyPath to ignore all the user's IE settings (e.g., font size) and use IE defaults, or GetOverrideKeyPath to use most of the user's IE settings but override a few specific ones.

The MSDN articles linked above contain good documentation on how to use this interface, as well as sample implementations of the IDocHostUIHandler interface and its methods.

Say that your GetOptionKeyPath method returns "SOFTWARE\MyCompany\MyApp\IE" as the new registry path. To ensure that script debugging is disabled, you would need to create the HKEY_CURRENT_USER\Software\MyCompany\MyApp\IE\Main registry key, then create a string value named Disable Script Debugger having the value yes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文