ShowWindow not hiding new window opened by IWebBrowser2

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.
 
R

Rob ^_^

Hi JM,

The correct newsgroup for your question is
microsoft.public.inetsdk.programming.webbrowser_ctl

but that aside, some popup blockers force popup windows to open in the
background. Try turning off your popup blocker... You will have to find a
way to defeat this in your final app... remember to test, test, test.

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top