Microsoft KB Archive/251135: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 103: Line 103:
   Set g_ieAuto = New InternetExplorer
   Set g_ieAuto = New InternetExplorer
   g_ieAuto.Visible = True
   g_ieAuto.Visible = True
   g_ieAuto.Navigate2 "http://msdn.microsoft.com/workshop"
   g_ieAuto.Navigate2 "http://msdn.microsoft.com/workshop"
End Sub
End Sub


Private Sub g_ieAuto_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Private Sub g_ieAuto_DocumentComplete(ByVal pDisp As Object, URL As Variant)
   g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}"
   g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}"
End Sub
End Sub
                     </pre></li>
                     </pre></li>
<li>On the '''Run''' menu, click '''Start''' or press the F5 key to start the program. The error message will appear.</li>
<li>On the '''Run''' menu, click '''Start''' or press the F5 key to start the program. The error message will appear.</li>
<li><p>Change the call to ShowBrowserBar to the following:</p>
<li><p>Change the call to ShowBrowserBar to the following:</p>
<pre class="codesample">  g_ieAuto.ShowBrowserBar &quot;{30D02401-6A81-11D0-8274-00C04FD5AE38}&quot;, Empty
<pre class="codesample">  g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}", Empty
                     </pre></li>
                     </pre></li>
<li>On the '''Run''' menu, click '''Start''', or press the F5 key to start the program. The error message does not appear and the '''Search''' bar is displayed.</li></ol>
<li>On the '''Run''' menu, click '''Start''', or press the F5 key to start the program. The error message does not appear and the '''Search''' bar is displayed.</li></ol>

Latest revision as of 13:51, 21 July 2020

Article ID: 251135

Article Last Modified on 5/12/2003



APPLIES TO

  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.01
  • Microsoft Internet Explorer 5.5
  • Microsoft Visual Basic 5.0 Learning Edition
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition



This article was previously published under Q251135

SYMPTOMS

Calling the InternetExplorer object's ShowBrowserBar method without the optional second parameter (pvarShow) produces the following error message:

Run-time Error '13':
Type Mismatch


The same error occurs if Null (or 0 or vbNull or vbNullString) is used for the second parameter.

CAUSE

ShowBrowserBar does not check for the variant types VT_ERROR and VT_NULL (passed by a missing parameter and the Visual Basic keyword Null, respectively) when determining the validity of the pvarShow parameter.

RESOLUTION

The second parameter must be present and must be declared as a variant having one of three values: true, false, or empty (an uninitialized variant). Note that passing empty has the same effect as passing true, since the default action is to show the bar.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. Add a reference to the Microsoft Internet Controls (Shdocvw.dll) using References on the Project menu.
  3. Copy the following code into the Code window of Form1:

    Dim WithEvents g_ieAuto As InternetExplorer
    
    Private Sub Form_Load()
       Set g_ieAuto = New InternetExplorer
       g_ieAuto.Visible = True
       g_ieAuto.Navigate2 "http://msdn.microsoft.com/workshop"
    End Sub
    
    Private Sub g_ieAuto_DocumentComplete(ByVal pDisp As Object, URL As Variant)
       g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}"
    End Sub
                        
  4. On the Run menu, click Start or press the F5 key to start the program. The error message will appear.
  5. Change the call to ShowBrowserBar to the following:

       g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}", Empty
                        
  6. On the Run menu, click Start, or press the F5 key to start the program. The error message does not appear and the Search bar is displayed.


REFERENCES

For additional information, please see the following MSDN Web Workshop site:


Additional query words: IWebBrowser2, InternetExplorer, WebBrowser

Keywords: kbbug kbpending KB251135