隐藏打开网页(使用IWebBrowser2)
if (SUCCEEDED(OleInitialize(NULL)))
{
IWebBrowser2* pBrowser2;
CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (void**)&pBrowser2);
if (pBrowser2)
{
VARIANT vEmpty;
VariantInit(&vEmpty);
BSTR bstrURL = SysAllocString(L"http://microsoft.com");
HRESULT hr = pBrowser2->Navigate(bstrURL, &vEmpty, &vEmpty, &vEmpty, &vEmpty);
if (SUCCEEDED(hr))
{
pBrowser2->put_Visible(VARIANT_TRUE); //这里参数改为“VARIANT_FALSE”就是隐藏IE 不知道是不是你说的“后台”
}
else
{
pBrowser2->Quit();
}
SysFreeString(bstrURL);
pBrowser2->Release();
}
OleUninitialize();
}