Dim s As String
Dim strA As String '采用异步调用web server 的方法
Dim oCls As clscalback2
On Error Resume Next
Set http1 = New MSXML2.XMLHTTP
strA = "submit1=Submit&verid=" + verid '参数头
http1.open "post", "http://211.138.14.167/version/Service1.asmx/getvertion", True
http1.setRequestHeader "Content-Length", Len(strA) '参数头
http1.setRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded" '通过查询web server获得
Set oCls = New clscalback2
http1.onreadystatechange = oCls
http1.send (strA)
以下是类的默认函数,必须将该函数设成默认。
Public Function Foo1() '回调函数
Dim s As String
Dim s1 As String
If http1.ReadyState = 4 Then
s = http1.responseText
s = Mid(s, 1, Len(s) - 10)
For i = Len(s) To 1 Step -1
If Mid(s, i, 1) = ">" Then
Exit For
End If
Next i
s1 = Mid(s, i + 1)
FrmMain.Timer1.Enabled = False
If s1 <> "0" Then
Dim a As Integer
a = MsgBox("有最新的版本,要升级吗?", vbExclamation + vbYesNo, "是否升级")
If a = 6 Then