在 C++ 中调试使用 IWebBrowser2 渲染的 javascript / html

发布于 2025-01-08 04:00:59 字数 399 浏览 4 评论 0原文

我正在使用 Pandion(开源 jabber 客户端),C++ 设置一个使用 IWebBrowser2 运行 html/javascript 的主机。所有的程序逻辑都是用js实现的。在VS2010中,如果我在调试器中启动应用程序,我可以调试C++,但不能调试js。如果我在没有调试器的情况下启动然后附加它,我可以调试 js,但不能调试 C++。

  1. 有什么办法可以同时调试两者吗?
  2. 有没有办法像 Firefox 中的 firebug 或 IE 中的开发人员工具那样显示 html?

我试图解决的具体错误是,更新时,更新窗口关闭,即使它不应该关闭。有些东西在 html 表单上调用提交,然后 js 调用 C++ 函数来中止文件下载。我试图追踪什么调用了提交,但堆栈窗口只显示绑定到 onsubmit 的匿名函数。

I'm working with Pandion (open source jabber client), the C++ sets up a host for running html/javascript using IWebBrowser2. All of the program logic is implemented in js. In VS2010 if I start the application in the debugger, I can debug the C++ but not the js. If I start without the debugger and then attach it, I can debug the js but not the C++.

  1. Is there any way to be able to debug both?
  2. Is there any way to display the html the way firebug would in Firefox, or the developer tools in IE?

The specific error I'm trying to solve is that when updating, the update window closes even though its not supposed to. Something calls submit on the html form, the js then calls a c++ function to abort the file download. I'm trying to track down what calls submit, but the stack window just shows the anonymous function bound to onsubmit.

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

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

发布评论

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

评论(1

吝吻 2025-01-15 04:00:59

找到了具体问题的答案:“下载安装程序”按钮是使用 document.createElement("button") 创建的,默认为提交按钮。我在其下面添加了button.type =“button”,现在表单不会过早提交。

但是,我仍然找不到任何在调试 c++ 代码和 js 代码之间切换的方法,因此尝试追踪某些 c++ 调用 js 函数的位置几乎是不可能的。

Found the answer to the specific problem: the "download installer" button was created using document.createElement("button"), which defaulted to a submit button. I added button.type = "button" below it, and now the form is not submitted prematurely.

However, I still can't find any way of switching between debugging c++ code and js code, so trying to track down where some c++ calls a js function is nearly impossible.

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