Occurs when a new window is to be created for displaying a resource.
Syntax
Private object_NewWindow2 (ByVal ppDisp As Object, ByVal Cancel As Boolean)
Parameters
- object
- An object expression that evaluates to an object in the Applies To list.
- ppDisp
- An object expression that, optionally, receives a new, hidden WebBrowser or InternetExplorer object with no URL loaded.
- Cancel
- A Boolean value that, when set to TRUE, is used to cancel the navigation.
Remarks
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.The application processing this notification can respond in one of three ways:
- 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.
- Cancel the navigation by setting Cancel to true.
- 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.
In Internet Explorer, this event is not fired when Window is selected from the New option on the File menu.
Applies To
InternetExplorer, WebBrowser
See Also
Microsoft Knowledge Base HOWTO: Cause navigation to occur in same Internet Explorer 4.0 Web[axsdk] , Microsoft Knowledge Base HOWTO: Use the WebBrowser Control NewWindow2 Event , NavigateComplete2