iesniffer OnWBNewWindow2 event
Return to Introduction  Previous page  Next page
Applies to
IESniffer component.  

  TIEWebBrowserNewWindow2 = procedure(Sender: TObject; const URL: Stringconst Browser: IWebBrowser2;  
    var ppDisp: IDispatch; var Cancel: WordBool) of object;  
property OnWBNewWindow2: TIEWebBrowserNewWindow2;  

The OnWBNewWindow2 event occurs when a new, hidden, non-navigated Web browser window is needed.  
Write an OnWBNewWindow2 to take specific action immediately before the Web browser creates a new window for displaying a resource. This window may be needed because the user shift-clicked on a link, the user right-clicked on a link and chose "open in new window", the frame for the target URL does not yet exist, or the Navigate or Navigate2 methods of IWebBrowser2 interface requested that the target document appear in a new window.  
Browser is the IWebBrowser2 interface that needs a new window to display its target resource.  
ppDisp optionally returns the interface for a newly created, hidden, TWebBrowser component that can act as the new window. The Web browser configures this component and navigates to the target URL, starting with an OnWBBeforeNavigate2 event. If the event handler does not create a component and return its interface as the ppDisp parameter, the Web browser generates a top-level window as a separate, nonhosted process.  
Cancel allows the event handler to block the creation of a new window. When the event handler sets Cancel to True, the Web browser tries to display the target resource in its current window, starting with an OnWBBeforeNavigate2 event.  

The event handler should not return a value for ppDisp when setting Cancel to True.  

See also
OnWBBeforeNavigate2 event.