当前位置:首页 > 编程 > VB 编程 > 正文内容

VB 版本检查升级模块

Cristian_Ng5年前 (2021-07-07)VB 编程
'模块
'模块名称UpdateModule
Function UpdateCheck() '升级检查
Dim NUrl As String
Dim NFile As String
Dim ExeLen As String
Dim ServerUrl as string
ServerUrl = "http://..."
iniPath$ = App.Path & "\Version.ini"
With Form1
entry = .VersionNumber.Caption: r = WritePrivateProfileString("Info", "VersionNumber", entry, iniPath)
entry = .FormName.Caption: r = WritePrivateProfileString("Info", "FormName", entry, iniPath)
entry = .FormCode.Caption: r = WritePrivateProfileString("Info", "FormCode", entry, iniPath)
entry = Format(Date, "yyyy-mm-dd") & " " & Format(Now, "HH:MM:ss"): r = WritePrivateProfileString("Info", "LastRun", entry, iniPath)
End With
If Dir(App.Path & "\Update", vbDirectory) = "" Then
    MkDir App.Path & "\Update"
End If
NUrl = ServerUrl & "/programupdate/UpdateSetting.txt"
NFile = App.Path & "\Update\UpdateSetting.ini"
If Dir(NFile) <> "" Then
Kill NFile
End If
Call Form1.Cdf_DownLoad(NUrl, NFile)
If Dir(NFile) <> "" Then
iniPath$ = NFile
Form1.UpdateTemp.Text = GetFromINI("Setting", "Size", iniPath)
End If
If Dir(App.Path & "\Update.exe") <> "" Then
ExeLen = FileLen(App.Path & "\Update.exe")
Else
ExeLen = 0
End If
If clng(ExeLen) = clng(Form1.UpdateTemp.Text) Then '大小一致
Call ShellExecute(0, "open", App.Path & "\Update.exe", 0, 0, 1)
Else '大小不一致
if dir(App.Path & "\Update.exe") <> "" then
Kill App.Path & "\Update.exe"
end if
NUrl = ServerUrl & "/programupdate/Update.rar"
NFile = App.Path & "\Update\Update.rar"
Call Form1.Cdf_DownLoad(NUrl, NFile)
FileCopy App.Path & "\Update\Update.rar", App.Path & "\Update.exe"
Kill App.Path & "\Update\Update.rar"
Call ShellExecute(0, "open", App.Path & "\Update.exe", 0, 0, 1)
End If
End Function
'窗口
'控件
'VersionFrame(frame)
'VersionNumber(label)
'FormName(label)
'FormCode(label)
'UpdateTemp(text)
'调用
'Call UpdateCheck '升级检查


“VB 版本检查升级模块” 的相关文章

2020-10-01 vb6 使用twain_32.dll开发扫描仪,摄像头等程序的demo

2020-10-01 vb6 使用twain_32.dll开发扫描仪,摄像头等程序的demo

twain_32.rar'模块'*******************************************************************************'' Description: VB Module for accessing TWAIN compatibl...

冒泡排序法

Private Sub Command1_Click()Dim a(1 To 10) As IntegerRandomizeList1.ClearFor i = 1 To 10a(i) = Rnd * 100List1.AddItem a(i)NextEnd SubPrivate Sub Comma...

VB 复制文件或文件夹到系统剪贴板

VB 复制文件或文件夹到系统剪贴板'-----------------------------------------------------------模块内容Option ExplicitPrivate Type POINTAPI    x As Long    y As LongEnd Typ...

Imagemagick 后台图片处理插件常用命令

  Imagemagick文档:http://www.imagemagick.org/script/command-line-options.php  convert功能强大,用来批处理图片的放大、缩小、裁剪、旋转、合并、水印、拼接、格式转换等都非常方便,特别适合后台的图片处理。1,获取图片信息  ...

vb 小时分钟秒换算秒 互换

Private Function ZToFSAll(ByVal ZT As Long) As String'全存样式'从天,时,分,秒整合为秒Dim T, S, F, M As Integer '天,时,分,秒Dim T1, S1 As Integer '天,时,分,秒Dim M1 As Strin...

VB 计算两个时间差

Private Sub Command1_Click()Text2.Text = Now()End SubPrivate Sub Command2_Click()MsgBox DateDiff("s", Text1.Text, Text2.Text)End SubPrivate Sub Form_L...