[求助]怎样通过检查文件修改日期来进行更新?
我在程序启动的时候写的代码:Private Sub Form_Load()
If gUserName <> "Guest" Then
s1 = "" & App.Path & "\a.exe"
s2 = "\\192.168.0.70\a\a.exe"
s3 = FileDateTime(s1)
s4 = FileDateTime(s2)
If s1 < s2 Then
a = "\\192.168.0.70\a\Update1.exe"
b = "" & App.Path & "\Update1.exe"
CopyFile a, b, False
If MsgBox("有新软件", vbExclamation + vbOKCancel, "是否安装") = vbOK Then
Shell ("" & App.Path & "\Update1.exe")
End
End If
End If
End If
End Sub
Update1的代码:
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Private Sub Form_Load()
If Dir("\\192.168.0.70\a\a.exe") <> "" Then
t1 = "" & App.Path & "\a.exe"
t2 = "\\192.168.0.70\a\a.exe"
t3 = FileDateTime(t1)
t4 = FileDateTime(t2)
If t1 < t2 Then
a = "\\192.168.0.70\a\a.exe"
b = "" & App.Path & "\a.exe"
CopyFile a, b, False
MsgBox "更新成功"
Shell (b)
End If
End If
Unload Me
End
End Sub
问题1:\\192.168.0.70\a\下的a.exe和目录下的a.exe是同样的,但是每次启动程序的时候,他还是会提示有新软件;
问题2:安装后提示内存不能为:read