Re: ShowWindow not hiding new window opened by IWebBrowser2
- From: "Matt Adamson" <Adamson_matthew@xxxxxxxxxxx>
- Date: Wed, 29 Nov 2006 11:30:13 -0000
Guys,
Is there no better solution to this?
Interestingly I've just had the same issue. I'm actually using Internet
Explorer for test automation of our web application. This is working really
well however I really want to ensure the browser is invisibible because I'm
launching NUnit tests which are using IE, and the NUnit tests are started
through the cruise control .NET service.
I didn't really want to have to change the options for the service to
"Interact with the desktop" which I presume I'd have to do if the window is
displayed. Do you know why the window certainly becomes visible after
setting it to invisible. I've added trace statements to all IE events which
is shown below
Before Navigate2 to URL
http://localhost/Sprinter3.6.2/General/FindSupplier.asp?SupplierID=-10000&FormID=EditInvoice&FieldID=Supplier
Download begins now
Command State change : Command = -1, Enable = False
OnVisible - Visible
Command State change : Command = 2, Enable = False
Command State change : Command = 1, Enable = False
The code for OnNewWindow is
/// <summary>
/// Fires when a new window is to be created
/// </summary>
/// <param name="newInternetExplorer"></param>
/// <param name="cancelNavigation"></param>
/// <param name="flags"></param>
/// <param name="urlContext">URL of the page opening the new
window</param>
/// <param name="url">URL being opened in the new window</param>
void OnNewWindow( ref Object newInternetExplorer,
ref Boolean cancelNavigation,
uint flags,
String urlContext,
String url)
{
Trace.WriteLineIf( traceSwitch.TraceLevelInfo,
String.Format( "OnNewWindow - URL = '{0}'",
url));
InternetExplorer newWindowInternetExplorer = new
InternetExplorerClass();
newWindowInternetExplorer.RegisterAsBrowser= true;
newWindowInternetExplorer.Visible = initialWindowStateVisible;
newInternetExplorer = newWindowInternetExplorer.Application;
InternetExplorerWrapper ieWrapper = new InternetExplorerWrapper();
ieWrapper.Attach(newWindowInternetExplorer);
newIeWindows[url] = ieWrapper;
}
Any thoughts?
"Igor Tandetnik" <itandetnik@xxxxxxxx> wrote in message
news:%23pB%23T5zEHHA.992@xxxxxxxxxxxxxxxxxxxxxxx
jmpinchot@xxxxxxxxx wrote:
m 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.
Sink DWebBrowserEvents2 from the new window, wait for
OnVisible(VARIANT_TRUE), and _then_ hide the window, either with
ShowWindow or with IWebBrowser2::put_Visible
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: ShowWindow not hiding new window opened by IWebBrowser2
- From: Igor Tandetnik
- Re: ShowWindow not hiding new window opened by IWebBrowser2
- References:
- ShowWindow not hiding new window opened by IWebBrowser2
- From: jmpinchot
- Re: ShowWindow not hiding new window opened by IWebBrowser2
- From: Igor Tandetnik
- ShowWindow not hiding new window opened by IWebBrowser2
- Prev by Date: Re: ShowWindow not hiding new window opened by IWebBrowser2
- Next by Date: Re: ShowWindow not hiding new window opened by IWebBrowser2
- Previous by thread: Re: ShowWindow not hiding new window opened by IWebBrowser2
- Next by thread: Re: ShowWindow not hiding new window opened by IWebBrowser2
- Index(es):
Relevant Pages
|
|