如何用 C++ 制作网页浏览器没有依赖关系?
如何在 C++ 中使用 IE 控件或某种 Web 浏览器而不需要任何外部依赖项?我的意思是可以用纯win api 或类似的东西来完成吗? 我了解 C++ 的基础知识,并且我知道使用网络浏览器控件的方法需要 C++ 库才能工作。
编辑:
抱歉,我的问题不清楚,有时我真是个菜鸟。我的意思是,我希望我编译的 exe 可以在所有 Windows 上运行,而无需安装任何类型的库,但我也希望我编译的 exe 不需要随任何 dll 一起提供,只需 exe 即可,它应该得到从基本 Windows 系统(即全新的 winXP(或其他版本)安装)运行所需的所有依赖项
How can I use IE control or some kind of webbrowser in c++ but without any external dependencies? I mean can be done with pure win api or something like that?
I know the basics of c++ and the methods I know to use the webbrowser control needs the c++ libs to work.
Edit:
Sorry my question is unclear, im such a noob sometimes. What I mean is that I want that my compiled exe works on all windows without having to install any kind of libraries, but also I want that my compiled exe doesn't need to be shipped with any dlls, just the exe and it should get all the dependencies it needs to work from a base windows system (ie. a fresh winXP (or other version) install)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
托管 Internet Explorer:
也可以托管 WebKit 或 Gecko...
仅使用 GDI 等从头开始编写自己的代码可能不是一个好主意。
Hosting Internet Explorer:
It is also possible to host WebKit or Gecko...
Writing your own from scratch using only GDI etc is probably not a good idea.
是的,这很容易。只需创建一个新对话框或其他内容,然后转到“工具箱”窗口,右键单击并选择“添加项目...”。从那里,在 COM 控件中,找到“Microsoft Web 浏览器”(我认为它的名字是这样的)。添加后,您将能够将网络浏览器从工具箱拖到对话框中。
Yes, it's easy. Just create a new dialog or something, then go to the Toolbox window, right-click and choose "Add Items...". From there, in the COM controls, find "Microsoft Web Browser" (I think it's called). After you've added that, you will be able to drag the web browser onto your dialog from the toolbox.
如果您不介意 MFC,则可以通过将 Web 浏览器编译为静态项目来将其构建为单个可执行文件。您必须按照此处所述使用 CHtmlView 类和此处。编译后的 exe 将在所有 Windows 上运行,您只需要单个 exe 文件,所有必需的库都将编译到该 exe 中。
If you don't mind MFC, you can build a webbrowser into a single executable by compiling it as a static project. You will have to use the CHtmlView class as described here and here. The compiled exe will work on all windows and you will only need the single exe file, all necessary libraries will be compiled into that exe.