Computing.Net > Forums > Programming > WebBrowser Control in VB6

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

WebBrowser Control in VB6

Reply to Message Icon

Name: Burbble
Date: December 17, 2002 at 14:24:25 Pacific
OS: Windows ME
CPU/Ram: Celeron 600mhz / 384 MB
Comment:

Hi,

I've tried many different ways to figure this out, but I simply cannot! Perhaps someone else can...

I am trying to use the NewWindow2 event of the WebBrowser Control in Visual Basic 6. In the event, there is a "ppDisp as Object" parameter which I cannot figure out how to use. I want it to create another form from my program when a NewWindow2 event is executed, instead of an Internet Explorer window appearing. I looked through Microsoft's site and found this, but it didn't help me. Perhaps it will help you?

-----

The NewWindow2 event is fired when a window is about to be created, such as during the following actions:

The user clicks a link while pressing the SHIFT key.
The user right-clicks a link and selects Open In New Window.
The user selects New Window from the File menu.
There is 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, nonnavigated 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.

-----

I know how to prevent anything from happening, but I want another form from my program to appear instead of an Internet Explorer window.

Thanks for your help!

-Burbble



Sponsored Link
Ads by Google

Response Number 1
Name: HiJinx
Date: December 17, 2002 at 16:07:40 Pacific
Reply:

If you want a new form identical to the current one, you'd use something like the following:

Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)

Dim frmNew As Form1

Set frmNew = New Form1

Set ppDisp = frmNew.WebBrowser1.Object

frmNew.Show

End Sub


0

Response Number 2
Name: Burbble
Date: December 18, 2002 at 03:57:27 Pacific
Reply:

Thanks! It's so simple; I was omitting the ".Object" on the "Set ppDisp =" line.

Thanks again for your help!

-Burbble


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Visual basic compaq quick restore?



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: WebBrowser Control in VB6

Wave files in VB6 www.computing.net/answers/programming/wave-files-in-vb6/5131.html

ActiveX control in VB6.0 www.computing.net/answers/programming/activex-control-in-vb60-/5323.html

WebBrowser control - VB6 www.computing.net/answers/programming/webbrowser-control-vb6/8848.html