NewWindow2 EventNewWindow2 Event*
*Contents  *Index  *Topic Contents
*Previous Topic: NavigateComplete2 Event
*Next Topic: OnFullScreen Event

NewWindow2 Event

Description

Occurs when a new window is to be created for displaying a resource. Some actions that can cause this include the user shift-clicking on a link, the user right-clicking on a link and choosing "open in new window", or a targeted navigation to a frame name that does not yet exist. Your browser application can also trigger this event by calling the Navigate or Navigate2 method with the navOpenInNewWindow flag. The WebBrowser control has an opportunity to handle the new window creation itself. If it does not, a top-level Internet Explorer window is created as a separate (nonhosted) process.

Syntax

Private object_NewWindow2 (ByVal ppDisp As Object, ByVal Cancel As Boolean)

ValueDescription
objectAn object expression that evaluates to an object in the Applies To list.
ppDispAn object expression that, optionally, receives a new, hidden WebBrowser or InternetExplorer object with no URL loaded.
CancelA Boolean value that, when set to TRUE, is used to cancel the new window creation and attempt the navigation in the current window.

Remarks

The application processing this notification can respond in one of three ways:

  1. Create a new, hidden, non-navigated WebBrowser or InternetExplorer object that is returned in ppDisp. Upon return from this event, the object that fired this event will then configure and navigate (including a BeforeNavigate2 event) the new object to the target location.
  2. Cancel the new window creation by setting Cancel to true. No object is created and the navigation is attempted on the current window (with an accompanying BeforeNavigate2 event).
  3. Do nothing and do not set ppDisp to any value. This will cause the object that fired the event to create a new InternetExplorer object to handle the navigation.

Applies To

InternetExplorer, WebBrowser

See Also

NavigateComplete2


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.