'卡巴2010版key下载助手
Option Explicit
Option Compare Text
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Public Function DownloadFile(sSourceUrl As String, sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0&, sSourceUrl, sLocalFile, BINDF_GETNEWESTVERSION, 0&) = ERROR_SUCCESS
End Function
Sub Main()
Dim i As Long, A As String, B() As String, Y As String, Key9 As String
A = GetHtmlStr$("http://www.zhaokey.com.cn/kabakey.html")
Y = "http://www.zhaokey.com.cn/kabakey/KAV9/"
B = Split(A, vbCrLf)
For i = 0 To UBound(B)
If InStr(B(i), ".rar") > 0 And InStr(B(i), Y) > 0 Then
Key9 = Mid(B(i), InStr(B(i), Y), (InStr(B(i), ".rar") + 4) - InStr(B(i), Y))
Exit For
End If
Next i
If DownloadFile(Key9, App.Path & "\" & Mid$(Key9, InStrRev(Key9, "/") + 1)) Then
End If
End Sub
Private Function GetHtmlStr$(URL$)
Dim XmlHttp
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
XmlHttp.Open "Get", URL, False
XmlHttp.send
Do While (XmlHttp.ReadyState <> 4)
DoEvents
Loop
GetHtmlStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
Set XmlHttp = Nothing
End Function
Option Explicit
Option Compare Text
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Public Function DownloadFile(sSourceUrl As String, sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0&, sSourceUrl, sLocalFile, BINDF_GETNEWESTVERSION, 0&) = ERROR_SUCCESS
End Function
Sub Main()
Dim i As Long, A As String, B() As String, Y As String, Key9 As String
A = GetHtmlStr$("http://www.zhaokey.com.cn/kabakey.html")
Y = "http://www.zhaokey.com.cn/kabakey/KAV9/"
B = Split(A, vbCrLf)
For i = 0 To UBound(B)
If InStr(B(i), ".rar") > 0 And InStr(B(i), Y) > 0 Then
Key9 = Mid(B(i), InStr(B(i), Y), (InStr(B(i), ".rar") + 4) - InStr(B(i), Y))
Exit For
End If
Next i
If DownloadFile(Key9, App.Path & "\" & Mid$(Key9, InStrRev(Key9, "/") + 1)) Then
End If
End Sub
Private Function GetHtmlStr$(URL$)
Dim XmlHttp
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
XmlHttp.Open "Get", URL, False
XmlHttp.send
Do While (XmlHttp.ReadyState <> 4)
DoEvents
Loop
GetHtmlStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
Set XmlHttp = Nothing
End Function