在IWebBrowser2 OLE控件中禁用脚本调试? C ++ [英] Disable script debugging in IWebBrowser2 OLE control? C++

查看:589
本文介绍了在IWebBrowser2 OLE控件中禁用脚本调试? C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IWebBrowser2我用来访问一些网页.Navigate()
当页面有一个js错误时,我有一个警告框语法错误,所以我使用。put_Silent(TRUE)。现在我收到VS即时调试程序:未处理的异常的警告

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)?

推荐答案

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

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.

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

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.

假设您的GetOptionKeyPath方法返回SOFTWARE\MyCompany\MyApp\IE作为新的注册表路径。要确保脚本调试已禁用,您需要创建 HKEY_CURRENT_USER\ SoftwareInstaller \MyCompany\MyApp\IE\Main 注册表项,然后创建一个字符串值禁用脚本调试器具有值 yes

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.

这篇关于在IWebBrowser2 OLE控件中禁用脚本调试? C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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