If Dir(ViewPath, vbDirectory) = "" And Dir(ImagePath, vbDirectory) = "" Then MkDir ImagePath MkDir ViewPath End If
gPath = "get \View\zhou.jpg " & ViewPath & "\zhou.jpg" ' gPath1 = "get \BusCom10000.exe " & ImagePath & "\BusCom10000.exe" Update.Execute , gPath Do While Update.StillExecuting DoEvents If (DateDiff("s", dDate, Now) > 30) Then MsgBox "更新资源出现问题,请断开防火墙重试...", vbCritical, "提示..." Unload Me End End If Loop Name gPath & "zhou.jpg" As ViewPath & "\zhou.jpg" ' Name gPath1 & "BusCom10000.exe" As ImagePath & "\BusCom10000.exe" MsgBox "更新程序成功!点击[确定]后启动新程序", vbInformation, "提示..." Unload Me End Exit Function err: If err.Number <> 58 Then MsgBox "更新资源失败,请联系系统管理员!" & vbCrLf & err.Description, vbCritical, "提示..." Else MsgBox " 程序已经运行,本次运行的程序将会自动退出", vbCritical End If Unload Me End Function
Dim gPath As String
Dim gPath1 As String
Dim dDate As Date
dDate = Now
Update.URL = "ftp://192.168.5.11"
Update.UserName = "update"
Update.PassWord = "zztmzztm"
ViewPath = "D:\View\"
ImagePath = "D:\Image\"
If Dir(ViewPath, vbDirectory) = "" And Dir(ImagePath, vbDirectory) = "" Then
MkDir ImagePath
MkDir ViewPath
End If
gPath = "get \View\zhou.jpg " & ViewPath & "\zhou.jpg"
' gPath1 = "get \BusCom10000.exe " & ImagePath & "\BusCom10000.exe"
Update.Execute , gPath
Do While Update.StillExecuting
DoEvents
If (DateDiff("s", dDate, Now) > 30) Then
MsgBox "更新资源出现问题,请断开防火墙重试...", vbCritical, "提示..."
Unload Me
End
End If
Loop Name gPath & "zhou.jpg" As ViewPath & "\zhou.jpg"
' Name gPath1 & "BusCom10000.exe" As ImagePath & "\BusCom10000.exe"
MsgBox "更新程序成功!点击[确定]后启动新程序", vbInformation, "提示..."
Unload Me
End
Exit Function
err:
If err.Number <> 58 Then
MsgBox "更新资源失败,请联系系统管理员!" & vbCrLf & err.Description, vbCritical, "提示..."
Else
MsgBox " 程序已经运行,本次运行的程序将会自动退出", vbCritical
End If
Unload Me
End Function