PDA

Click to See Complete Forum and Search --> : WebBrowser Control - NewWindow2 event, how do i use the ppDisp object??


Mar 21st, 2000, 11:45 AM
Hello,

Can someone please help me with a prob that is really annoying me. i want to use the NewWindow2 event of the WebBrowser control to open a new web page in a browser thats in my program and not in a new IE window. I think it can be done using the ppDisp object that is passed, but what do i do with this object?? i have no idea, please help! thanks

Jericho

CarlosTheJackal
Mar 22nd, 2000, 04:03 AM
Ok, This is kinda hard to explain so bear with me...
ppDisp is the webbrowser object that the new page will be loaded in, so for instance if you had a form (frmMain) with a webbrowser (wbMain)....

In a module you'd have:


Dim frmMain2 as frmMain 'Declare a new copy of your form

Then In WbMain_NewWindow2 Sub of your frmMain you'd have:

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

Set FrmMain2 = New FrmMain 'Makes frmMain2 an exact copy of frmMain

Set ppDisp = frmMain2.WbMain.object 'Sets the new forms webbrowser to be the thing displaying the page

frmMain2.show 'Shows the new form, its webbrowser will load the new page

End Sub


This will show a new copy of your form and have it's browser navigate to the new page.

Sorry if this code's formatting is messed up, im kinda in a hurry =P
ohhh and you will probably need to change the code for the x button on any new forms and and exit buttons, i use a variable to keep track of how many copies i have running.


Hope This Helps, If You Need and more help just reply to this msg =)

Thnx For Your Time,
CarlosTheJackal

Mar 22nd, 2000, 08:48 PM
Thanks for the help!

Just after i posted that message i went to the microsoft msdn site and found pretty much the same code. thanks for the response anyway.
what i ended up doing was using this code

Set ppDisp = WebBrowser1.object

because im using multiple webbrowser controls on the one form.

Jericho