VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



UPDATED WebBrowser Control Bug in IE 5.5

by Rabid Nerd Productions (4 Submissions)
Category: Debugging and Error Handling
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (13 Votes)

After developing a full-blown application (just went out to beta) for my employer, I uncovered a bug in IE 5.5 that you may want to know about.

Rate UPDATED WebBrowser Control Bug in IE 5.5

UPDATE! - 12/26/2000
Microsoft LISTS THIS BUG OFFICIALLY at:
http://support.microsoft.com/support/kb/articles/Q279/6/68.ASP
End UPDATE 


UPDATE! - Sent from Microsoft
Herb,



 



Thanks for sending in the codes. I am able to 
reproduce the same problem with your code. I verified that in IE5 navigate2 accept a string as 
URL, in IE5.5 it only accept a variant. Or you could pass in the url inline without using a 
variable. Then I looked at the source of both versions and set up a debugger to verify. Here is the situation:



When you specific the URL as a string, VB will passed in VT_BSTR|VT_BYREF



In both IE5.0 and IE5.5, the header info are the same in the IDL file which accept a variant



[id(0x000001f4), helpstring("Navigates to a URL or file or pidl.")]



HRESULT Navigate2(



    [in] VARIANT* URL, 



    [in, optional] VARIANT* Flags, 



    [in, optional] VARIANT* 
TargetFrameName, 



    [in, optional] VARIANT* PostData, 



    [in, optional] VARIANT* Headers);



However, the implementations are different.



In IE5.0, the URL param could be VT_BSTR, 
VT_BSTR|VT_BYREF or VT_ARRAY|VT_UI1



In IE5.5, it uses a function to determine the values of the URL and it only accepts VT_BYREF | 
VT_VARIANT or VT_BSTR



So, it returns an error E_INVALIDARG when VB passed in VT_BSTR|VT_BYREF.



 

And I filed a bug on this.



So at the mean time, you would have to use variant as I believe passing the url inline
 probably won’t go too far in most applications.


 



Please let me know if you have any more concerns.



Joshua Lee (MCP + Site Building)



Content Lead



Internet Client Team



Microsoft Developer Support

End UPDATE. Original article follows:

In the Microsoft Knowledge Base article at:

http://support.microsoft.com/support/kb/articles/Q269/6/14.ASP?LN=EN-US&SD=SO&FR=1

A bug in IE 5.5 users' WebBrowser controls is exposed.
The WebBrowser1_NavigateComplete event is NOT FIRED when the control is set to visible = FALSE.(Invisible)

I have also found another bug (and I am working with Microsoft on it) with the 5.5 WebBrowser Control:

When you use a string variable in the Navigate2 method, the control fails to navigate (and may cause an error!)


Here is a code that you can place in a form with a webbrowser control on it:


Sub form_load()
Dim urly As String
urly = "http://directleads.com/ad.html?o=993&a=cd15860"
WebBrowser1.Navigate2 urly
End Sub
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
MsgBox "Hello!"
End Sub

When you execute this code on a computer with IE other than 5.5, You will get the appropriate MsgBox with
Hello! in it (and our website). With 5.5, however, you will get and Error 5.

The workaround is to declare the URL variable (urly) as a Variant -OR- Use the Navigate (no 2) Method. (as described in the
 MS Knowledge Base (See #28). The variant may not be as efficient as the string type, but it works on ALL versions of IE. 

If you appreciate this 'bulletin' of sorts, I humbly ask for a vote. I understand this is not an application, but hey
 it's important to anyone with a webbrowser control on their app!

Have Fun,
Herbert L. Riede
Programmer, WinDough.com, Inc.

Download this snippet    Add to My Saved Code

UPDATED WebBrowser Control Bug in IE 5.5 Comments

No comments have been posted about UPDATED WebBrowser Control Bug in IE 5.5. Why not be the first to post a comment about UPDATED WebBrowser Control Bug in IE 5.5.

Post your comment

Subject:
Message:
0/1000 characters