Microsoft KB Archive/174836: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
Line 85: Line 85:
</p>
</p>
<pre class="codesample">      Public Sub AddURL(ByVal sURL As String, _
<pre class="codesample">      Public Sub AddURL(ByVal sURL As String, _
         Optional ByVal sTitle As String = &quot;&quot;, _
         Optional ByVal sTitle As String = "", _
                 Optional ByVal sSize As String = &quot;&quot;, _
                 Optional ByVal sSize As String = "", _
                       Optional ByVal lSizeUnit As Long = 0)
                       Optional ByVal lSizeUnit As Long = 0)
         inetDownload.Execute sURL, &quot;GET&quot;
         inetDownload.Execute sURL, "GET"
       End Sub
       End Sub


Line 105: Line 105:


             ' ResponseInfo.
             ' ResponseInfo.
                 vtData = Inet1.ResponseCode &amp; &quot;:&quot; &amp; _
                 vtData = Inet1.ResponseCode &amp; ":" &amp; _
                 Inet1.ResponseInfo
                 Inet1.ResponseInfo


             Case icResponseCompleted  ' 12
             Case icResponseCompleted  ' 12
                 Dim strData As String: strData = &quot;&quot;
                 Dim strData As String: strData = ""
                 Dim bDone As Boolean: bDone = False
                 Dim bDone As Boolean: bDone = False


Line 129: Line 129:


               Case icDisconnected
               Case icDisconnected
                   Debug.Print &quot;* Disconnected&quot;
                   Debug.Print "* Disconnected"
                   Unload Me
                   Unload Me


Line 150: Line 150:
</p>
</p>
<pre class="codesample">      Private Sub Command1_Click()
<pre class="codesample">      Private Sub Command1_Click()
         form1.AddURL &quot;http://www.microsoft.com&quot;
         form1.AddURL "http://www.microsoft.com"
       End Sub
       End Sub



Revision as of 11:07, 21 July 2020

Article ID: 174836

Article Last Modified on 8/20/2007



APPLIES TO

  • Microsoft Visual Basic 5.0 Control Creation Edition
  • Microsoft Visual Basic 5.0 Learning Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition



This article was previously published under Q174836

SYMPTOMS

The IDE and Visual Basic-created .exe files hang when shutting down if they have used the Internet Transfer Control in their project.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Studio 97 Service Pack 3.

For more information, please see the following article in the Microsoft Knowledge Base:

170365 : INFO: Visual Studio 97 Service Packs - What, Where, and Why



For a list of the Visual Basic 5.0 bugs that were fixed in the Visual Studio 97 Service Pack 3, please see the following article in the Microsoft Knowledge Base:

175450 : INFO: Visual Basic 5.0 Fixes in Visual Studio 97 Service Pack 3


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Standard EXE project. Form1 is created by default. Add the following code:

          Public Sub AddURL(ByVal sURL As String, _
             Optional ByVal sTitle As String = "", _
                     Optional ByVal sSize As String = "", _
                           Optional ByVal lSizeUnit As Long = 0)
             inetDownload.Execute sURL, "GET"
          End Sub
    
                            
  2. From the Project menu, click Components, and select the Internet Transfer Control 5.0 into the project if it is not already loaded.
  3. Place an Internet Transfer Control 5.0 (Inet1) on Form1 and add the following code:

          Private Sub Inet1_StateChanged(ByVal State As Integer)
              Const lCHUNKSIZE As Long = 1024
              Dim vtData As Variant ' Data variable.
    
                 Select Case State
                 ' ... Other cases not shown.
                 Case icError ' 11
                     ' In case of error, return ResponseCode and
    
                ' ResponseInfo.
                     vtData = Inet1.ResponseCode & ":" & _
                     Inet1.ResponseInfo
    
                 Case icResponseCompleted  ' 12
                     Dim strData As String: strData = ""
                     Dim bDone As Boolean: bDone = False
    
                     ' Get first chunk.
                     vtData = Inet1.GetChunk(lCHUNKSIZE, icString)
                     DoEvents
    
                     Do While Not bDone
    
                         strData = strData & vtData
                         ' Get next chunk.
                         vtData = Inet1.GetChunk(lCHUNKSIZE, icString)
                         DoEvents
    
                         If Len(vtData) = 0 Then
                             bDone = True
                         End If
                     Loop
    
                  Case icDisconnected
                      Debug.Print "* Disconnected"
                      Unload Me
    
                 End Select
    
          End Sub
                            
  4. Add another form to your project. By default, it will be called Form2. IMPORTANT: Make Form2 your startup form by changing the properties of the project. Add the following code:

          Private Sub Form_Load()
              Load form1
          End Sub
    
          Private Sub Form_Unload(Cancel As Integer)
              Unload form1
          End Sub
    
                            
  5. Place a CommandButton (Command1) on Form2 and add the following code:

          Private Sub Command1_Click()
             form1.AddURL "http://www.microsoft.com"
          End Sub
    
                            
  6. From the Run menu, click Start (ALT, R, S), or press the F5 key to run the program. Click the Command1 button and you will see error described above.


Keywords: kbbug kbfix kbvbp500sp3fix kbvs97sp2fix KB174836