?
Solved

A Tough WebBrowser Problem

Posted on 2002-07-22
10
Medium Priority
?
179 Views
Last Modified: 2012-05-04
I am using Win98, IE6 and VB6.

I have a webbrowser on a form. I do not want a new window to open up, so this is what I did:

' ---------- Start code ------------

Dim WithEvents Web_VI As SHDocVwCtl.WebBrowser_V1

Private Sub Form_Load()
   Set Web_VI = WebBrowser1.Object
End Sub

Private Sub Web_VI_NewWindow(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Processed As Boolean)
   Processed = True
   WebBrowser1.Navigate2 URL
End Sub

' --------- End code ----------------

Whenever a new window tries to open, it does not, and the current window opens to the URL that was supposed to be in the new window.  Everything seems to work, except that after the Web_VI_NewWindow procedure, the form (along with textboxes) and the webbrowser cannot receive keyboard inputs!

What am I doing wrong?  Please help!

0
Comment
Question by:limva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 2

Expert Comment

by:ventond
ID: 7169176
If you have a WebBrowser control on your form, why do you create another one in code?

Why not just:

Private Sub Form_Load()
  WebBrowser1.Navigate2 URL
End Sub


0
 

Author Comment

by:limva
ID: 7169412
I made my code according to the instructions given here: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q185538
0
 

Author Comment

by:limva
ID: 7169432
Hi ventond, I found my answer!
I solved my problem by setting ppDisp to the Webbrowser object:

Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
   Set ppDisp = WebBrowser1.Object
End Sub

Now my next problem is, how do I delete this question?

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7169767
Ask to Community support not to delete but PAQ with 0 points. It will no cost you a penny.
Cheers
0
 

Author Comment

by:limva
ID: 7169959
Thanks Richie.  But my problem returned.

After I set ppDisp to Webbrowser.object, my webbrowser would not go to the link that wants to open a new window!

HELP Please!

0
 

Author Comment

by:limva
ID: 7170020
Sorry, my code actually works!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7170042
Good.
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 7170374
This question will be placed in PAQ, and points refunded.

Regards,

ComTech
Community Support Administrator  
Experts-Exchange  


Thanks for your help Richie.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7170401
Thanks to both of you. This question has valuable info itself.
I saw this question posted several times so it is nice to put in EE's db.
Cheers
PS: Sorry for extra work, Comp.
And special thanks to limva who shares his knowledge with others for free. ;)
0
 

Expert Comment

by:ComTech
ID: 7170548
You have never been a bother to me or any of the Mods, that is part of what we do.  The pleasure is all mine.

Thanks again,

CT  :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question