J
jmpinchot
Im writing an application that automates internet explorer, and am
integrating a mode that lets IE run invisibly to the user. I start
Internet Explorer with CreateProcess and the wShowWindow flag set to
SW_HIDE and everything works wonderfully. The problem arises when IE
tries to open a new window either as a result of a javascript open or
the target being set in a A tag.
Currently I'm creating the new instance of IE with CoCreateInstance,
and then calling ShowWindow(HWND, SW_HIDE) but the window still shows
up as visible.
Here's the code the creates the new window:
The caller:
IWebBrowser2 * newIE = IEBrowserControllerUtil::createBrowser(NULL,
headless);
if (newIE) {
IEBrowserControllerUtil::addNewEventSink(newIE, false,
_windowName);
*ppDisp = (IDispatch*)newIE;
}
The code the above call goes through
if (!SUCCEEDED(CoCreateInstance(CLSID_InternetExplorer, 0,
CLSCTX_SERVER, IID_IWebBrowser2,
(LPVOID*) &newIE))) {
<error cleanup code>
}
I've also tried calling CreateProcess to create the new window instead,
and setting the Visible property of the IWebBrowser2 instance; I get
the same result, the window is still visible to the user.
Is there something I'm missing? Any help would be greatly appreciated.
integrating a mode that lets IE run invisibly to the user. I start
Internet Explorer with CreateProcess and the wShowWindow flag set to
SW_HIDE and everything works wonderfully. The problem arises when IE
tries to open a new window either as a result of a javascript open or
the target being set in a A tag.
Currently I'm creating the new instance of IE with CoCreateInstance,
and then calling ShowWindow(HWND, SW_HIDE) but the window still shows
up as visible.
Here's the code the creates the new window:
The caller:
IWebBrowser2 * newIE = IEBrowserControllerUtil::createBrowser(NULL,
headless);
if (newIE) {
IEBrowserControllerUtil::addNewEventSink(newIE, false,
_windowName);
*ppDisp = (IDispatch*)newIE;
}
The code the above call goes through
if (!SUCCEEDED(CoCreateInstance(CLSID_InternetExplorer, 0,
CLSCTX_SERVER, IID_IWebBrowser2,
(LPVOID*) &newIE))) {
<error cleanup code>
}
I've also tried calling CreateProcess to create the new window instead,
and setting the Visible property of the IWebBrowser2 instance; I get
the same result, the window is still visible to the user.
Is there something I'm missing? Any help would be greatly appreciated.