通過(guò)讀取文件的各日期,防止修改系統(tǒng)時(shí)間來(lái)避開(kāi)試用期的程序。
同時(shí)也能一定限度的防止通過(guò)備份文件的方式來(lái)避開(kāi)試用期。
未做嚴(yán)格測(cè)試:
Private Sub FORM_Load()
Dim dd As String
dd = CurrentProject.Path
If Right(dd, 1) <> "\" Then dd = dd & "\"
ShowFileAccessInfo dd & CurrentProject.Name
End Sub
Sub ShowFileAccessInfo(filespec)
Dim fs, f, s, aa, bb, cc
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
aa = f.DateCreated '建立日期
bb = f.DateLastAccessed '最后訪問(wèn)日期
cc = f.DateLastModified '最后更新日期
If aa > bb Then GoTo ww:
If aa > cc Then GoTo ww:
If bb > cc Then GoTo ww:
If cc > Date Then GoTo ww:
Exit Sub
ww:
MsgBox "請(qǐng)不要修改系統(tǒng)日期!": Quit
End Sub