如何在 wxWidgets 应用程序中获取 Internet Explorer?

发布于 2024-10-05 10:33:50 字数 320 浏览 4 评论 0原文

当前使用 wxHTML 在基于 C++ Windows wxWidgets 的应用程序中显示远程网页。

但是,我需要更高级的功能,例如基本的 CSS 样式和 JavaScript。我想最简单的方法是嵌入 Internet Explorer。保持应用程序的 .exe 大小较小是关键,因此我认为 wxWebConnect 不适合。

我该怎么做?我发现了一些关于使用 ActiveX 在 wxWidget 应用程序中嵌入 IE 的参考,但我找不到任何示例或文档或任何内容。

更新:它使用 wxWidgets 的原因是历史性的。跨平台问题不用担心,它应该只在 Windows 中运行。

Currently using wxHTML to display a remote web page in a C++ Windows wxWidgets based application.

However, I need more advanced features like rudimentary CSS styling and JavaScript. The easiest way, I guess, would be to embed Internet Explorer. Keeping the .exe size of the application small is key, so I don't think wxWebConnect is a good fit.

How can I do this? I found some references to using ActiveX to embed IE in a wxWidget application, but I'm unable to find any examples or documentation, or anything.

Update: The reason why it is using wxWidgets are historical. Cross-plattform issues is no concern, it should only run in Windows.

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

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

发布评论

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

评论(2

反差帅 2024-10-12 10:33:50

使用 wxWidgets 而不是某些其他部件库的主要原因之一是 wxWindows 是跨平台兼容的。嵌入 IE 会破坏这一点。

这意味着(a)这可能不是一个好主意(即使您现在不为跨平台编写,您将来也可能会改变主意),并且(b)您不会发现很多其他人这样做,因此教程和示例将很难获得。

我的建议是考虑使用跨平台浏览器而不是 IE; Firefox 似乎是显而易见的选择。

考虑到这一点,我为您进行了快速谷歌搜索并提出了这个,这似乎可能是您的解决方案: http://www.kirix.com/labs/wxwebconnect.html

希望有帮助。

[编辑]
当然,基于 Firefox 的小部件将为您提供比当前版本的 IE 更好的 CSS/JS/HTML 渲染,因此这是使用它的另一个充分理由。

[编辑]
重新审视这个答案是因为我偶然发现了一个 Webkit 小部件,它也可能值得一看。这是我刚刚找到的链接:http://wxwebkit.kosoftworks.com/
(我知道这不会对 OP 带来任何改变,但对于找到此页面的其他人可能会有所帮助)

One of the main reasons for using wxWidgets over certain other widget libraries is that wxWindows is cross-platform compatible. Embedding IE would destroy that.

This means that (a) it's probably not a great idea (even if you're not writing for cross-platform now, you may change your mind in the future), and (b) you won't find many other people doing it, so tutorials and examples will be hard to come by.

My suggestion would be to consider a cross-platform browser instead of IE; Firefox seems like the obvious choice.

With that in mind, I did a quick google for you and came up with this, which seems like it may be a solution for you: http://www.kirix.com/labs/wxwebconnect.html

Hope that helps.

[EDIT]
Of course, a Firefox-based widget would give you much better CSS/JS/HTML rendering than current versions of IE, so that's another good reason to use it instead.

[EDIT]
Revisiting this answer because I stumbled upon a Webkit widget, which might also be worth checking out. Here's the link I just found: http://wxwebkit.kosoftworks.com/
(I know this doesn't change anything for the OP, but it might be helpful for anyone else who finds this page)

咋地 2024-10-12 10:33:50

我正是这样做的。这相当简单。本质上,您托管 MSHTML ActiveX 控件。 Internet Explorer 接受了该控制,并添加了按钮、历史记录、新窗口功能、选项卡等。然而,所有渲染、DOM 和 Javascript 部分均由 MSHTML 组件处理。

wxActiveX 组件将负责 ActiveX 托管的实际部分。 wxIE 显然是一个派生类,它将 wxActiveX 小部件与 MSHTML 控件结合在一起,并添加了一些修饰。 YMMV。

I've done precisely this. It's fairly straightforward. Essentially, you host the MSHTML ActiveX control. Internet Explorer takes that control, and adds buttons, a history, new window functionality, tabs, etcetera. However, all the rendering, DOM, and Javascript parts are handled by the MSHTML component.

The wxActiveX component will take care of the practical bits of ActiveX hosting. wxIE apparently is a derived class that combines the wxActiveX widget with the MSHTML control, and adds a bit of polish. YMMV.

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