Private Sub Command1_Click()
Command1.Enabled = False
Me.MousePointer = 11
If Len(Text1.Text) > 5 Then
Text2.Text = Inet1.OpenURL(Text1.Text, icString)
Else
MsgBox "输入网址错误"
End If
End SubPrivate Sub Form_Terminate()
If Inet1.StillExecuting Then
Inet1.Cancel
End If
End SubPrivate Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case icConnecting
Label2.Caption = "正在建立连接......"
Case icConnected
Label2.Caption = "建立连接成功"
Case icReceivingResponse
Label2.Caption = "正在传输数据......"
Case icError
Label2.Caption = "传输中发生错误"
Case icDisconnected
Label2.Caption = "数据传输完毕"
Me.MousePointer = 0
Command1.Enabled = True
End Select
End Sub
问题就在于等了很久都没有看到“数据传输完毕”!一直都是“正在传输数据......”。不知道是代码错误还是别的原因。
在下新手╮(╯_╰)╭

解决方案 »

  1.   

    Inet控件只有在异步传输的时候才能更新其全部状态,你用Inet1.OpenURL是同步传输,也就是说必须等到Inet1.OpenURL执行完后后面的语句才能执行,此时其状态其实没什么意义,OpenURL执行完毕就代表着数据接收完毕或出错;你用异步传输的Inet1.Execute方法,就可以显示所有的状态了,不过数据的接收得靠你自己写