
Private Sub Command1_Click()
R = URLDownloadToFile(0, Text1.Text, "Version.txt", 0, 0)
If R = 0 Then
'下载成功,则打开文件对比版本:把最新版本信息放第一行
Set fso1 = CreateObject("scripting.filesystemobject")
Set file0 = fso1.OpenTextFile("Version.txt", 1, 1)
d = file0.Readline
d = Trim(d)
If d = Trim(Text3.Text) Then
MsgBox "你的程序已经是最新版本,不需要更新!当前版本为:" &Text3.Text, 48, "恭喜你!"
Else
ifdl = MsgBox("你的程序不只最新版本,是否更新到最新版本?服务器版本为:" &d, vbYesNo, "出新版本了,你Y的 更新不?")
If ifdl = 6 Then
r1 = URLDownloadToFile(0, Text2.Text, "new.exe", 0, 0)
If r1 = 0 Then
MsgBox "更新完成,点击确定运行新版本"
Shell "new.exe", vbNormalFocus
End
End If
Else
MsgBox "下载失败,请检测网络连接是否正常,或者,服务器正常。", 16, "错误!灵魂口袋6921833"
End If
End If
file0.Close
Else
MsgBox "错误" &R &vbCrLf &"改芹前检测更新失败,请确定你的网络连接正常!", 16, "抱歉!有问题联系6921833"
End If
End SubPrivate Sub Command2_Click()
r1 = URLDownloadToFile(0, Text2.Text, "new.exe", 0, 0)
If r1 = 0 Then
MsgBox "更新完成,点击确定运行新版本"
Shell "new.exe", vbNormalFocus
End
Else
MsgBox "下载失败,请检测网络连接是否正常,或者,服务器正常。", 16, "错误!灵魂口袋6921833"
End If
End SubPrivate Sub Command3_Click()
End
End SubPrivate Sub Command4_Click()
R = URLDownloadToFile(0, Text1.Text, "Version.txt", 0, 0)
If R = 0 Then
'下载成功,则打开文件对比版本:把最新版本信息放第一行
Set fso1 = CreateObject("scripting.filesystemobject")
Set file0 = fso1.OpenTextFile("Version.txt", 1, 1)
d = file0.Readline
d = Trim(d)
If d = Trim(Text4.Text) Then
MsgBox "你的程序已经是最新版本,不需要更新!", 48, "恭喜你!"
Else
ifdl = MsgBox("你的程序不只最新版本,是否更新到最新版本?服务器版本为:" &d, vbYesNo, "出新版本了,你Y的 更新不?")
If ifdl = 6 Then
r1 = URLDownloadToFile(0, Text2.Text, "new.exe", 0, 0)
If r1 = 0 Then
MsgBox "更新完成,点击确定运行新版本"
Shell "new.exe", vbNormalFocus
End
End If
Else
MsgBox "下载失败,请检测网络连接是否正常,或者,服务器正常。", 16, "错误!灵魂口袋6921833"
End If
End If
file0.Close
Else
MsgBox "错误" &R &vbCrLf &"检测更新失败,请确定你的网络连接正常!", 16, "抱歉!有问题联系6921833"
End If
End Sub
首没耐先【工程】——>【饥郑引烂察颂用】,勾选Microsoft Scripting Runtime然后
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("d:\Downloads\software")
If App.Path <>f.Path Then
MsgBox "请把程序放在***文件夹里再运行", vbExclamation
Exit Sub
End If
If f.Files.Count >= 10 Then
MsgBox "文件夹完整", vbInformation
Else
MsgBox "缺少文件" &(10 - f.Files.Count) &"个"
End If
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)