Article ID: 184876 - Last Review: July 13, 2004 - Revision: 1.2 How To Use the WebBrowser Control NewWindow2 Event
This article was previously published under Q184876 SUMMARY This article describes how to use the NewWindow2 event,
fired by the Microsoft WebBrowser control provided with Microsoft Internet
Explorer 4.0, to specify that your browser application should be used in all
cases where a new browser window is opened. This article will describe this procedure using both Visual Basic 5.0 (VB) and the Microsoft Foundation Classes (MFC) that are part of Visual C++ 5.0 (VC). MORE INFORMATION The NewWindow2 event occurs when a new window is to be
created for displaying a resource. This event precedes the creation of a new
window from within the WebBrowser control, for example, in response to a
navigation targeted to a new window or to a scripted window.open method.
Event handlers for this event receive two out parameters:
In addition, set the RegisterAsBrowser property to TRUE for the newly created WebBrowser control in order for it to participate in window name resolution. For example, if this window name is used elsewhere in script, then this control will be used instead of a newly created one because it checks all of the existing window names before opening a new window. Here is some sample Visual Basic code to accomplish this:
REFERENCES For a Microsoft Visual Basic .NET version of this
article, see
311282
(http://support.microsoft.com/kb/311282/EN-US/
)
. "Reusing the WebBrowser and MSHTML" in the
Internet Client SDK Help: http://www.microsoft.com/msdn/sdk/inetsdk/help/
(http://www.microsoft.com/msdn/sdk/inetsdk/help/)
(c) Microsoft Corporation 1998, All Rights Reserved.
Contributions by Scott Roberts, Microsoft Corporation.APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email

Back to the top
