创建 IWebBrowser2 控件 [英] Creating an IWebBrowser2 control
本文介绍了创建 IWebBrowser2 控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想成功地将它添加到我的窗口中,这出奇地困难.
I just want to successfully add it to my window, and it has been surprisingly difficult.
我试过了
#include "windef.h"
#include "winbase.h"
#include "initguid.h"
#include "ole2.h"
#include "olectl.h"
#include "shobjidl.h"
#include "shlguid.h"
#include "exdispid.h"
#include <objidl.h>
#include "OleIdl.h"
#include "Objbase.h"
#include <exdisp.h>
#include <exdispid.h>
...
IWebBrowser2* pBrowser2;
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer, NULL,
CLSCTX_ALL, IID_IWebBrowser2, (void**)&pBrowser2);
获取
error: 'CLSID_InternetExplorer' undeclared (first use in this function)
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer,
我也试过
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (void**)&pBrowser2);
这个至少可以编译,但没有向窗口添加任何内容:
This one at least compiles, but nothing is added to the window:
hr = OleCreate(&CLSID_WebBrowser, &IID_IOleObject, 1/*OLERENDER_DRAW*/, 0,
&ClientSite, &Storage, (void**)&mpWebObject);
我尝试了所有可以在网上找到的头文件和库(如您所见).
I tried all headers and libraries I could find on the net (as you can see).
以下是我链接的库:
gcc -lmingw32 -mwindows -luser32 -lgdiplus -lole32 -luuid -loleaut32 -lcomctl32 -lcomdlg32 -ladvapi32 -loleaut32 -lshdocvw -lmf -lmfuuid
谢谢!
推荐答案
你可以试试 MinGW-w64.
这是 MinGW 的一个分支,除了支持 32 位和 64 位构建之外,它还在更积极的开发中.特别是改进了 Windows API 标头.
This is a fork of MinGW which , in addition to supporting both 32-bit and 64-bit builds, is under much more active development. In particular, having improved Windows API headers.
这篇关于创建 IWebBrowser2 控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文