先下载一个版本标示文件(*.txt,*.ini) 与本地的版本标示文件中的版本进行比较,如果有升级文件则下载。 主要下载程序如下: '***************************************************************************** ' 从服务器上下载一个文件 * '***************************************************************************** Private Sub OnlineUpdate(FLNM As String) On Error GoTo errReturn Dim VarTemp() As Byte Call SetInet1 With Inet1 VarTemp() = .OpenURL(strURL & FLNM, icByteArray) Open tempPath & "\" & FLNM For Binary Access Write As #1 Put #1, , VarTemp() Close #1 End With Inet1.Cancel Exit Sub errReturn: ErrSign = False MsgBox "下载文件" & FLNM & "时出错", vbInformation + vbOKOnly, "系统提示" End Sub'设置inet1控件 Private Sub SetInet1() On Error Resume Next With Inet1 .Protocol = icHTTP .Proxy = 1 .RemotePort = 80 .URL = strURL End With End Sub
与本地的版本标示文件中的版本进行比较,如果有升级文件则下载。
主要下载程序如下:
'*****************************************************************************
' 从服务器上下载一个文件 *
'*****************************************************************************
Private Sub OnlineUpdate(FLNM As String)
On Error GoTo errReturn
Dim VarTemp() As Byte Call SetInet1
With Inet1
VarTemp() = .OpenURL(strURL & FLNM, icByteArray)
Open tempPath & "\" & FLNM For Binary Access Write As #1
Put #1, , VarTemp()
Close #1 End With
Inet1.Cancel
Exit Sub
errReturn:
ErrSign = False
MsgBox "下载文件" & FLNM & "时出错", vbInformation + vbOKOnly, "系统提示"
End Sub'设置inet1控件
Private Sub SetInet1()
On Error Resume Next
With Inet1
.Protocol = icHTTP
.Proxy = 1
.RemotePort = 80
.URL = strURL
End With
End Sub