VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 如何自动记录计算机开机时间?
发表评论(0)作者:, 平台:, 阅读:11150, 日期:2000-03-12


如何自动记录计算机开机时间?





Option Explicit

Private Sub Command1_Click()

Dim TimeCalc As Date

TimeCalc = Timer

Label1.Caption = "希望本计算机让您使用愉快"


Do While Timer - TimeCalc < 1

DoEvents

Loop


Unload Me

End Sub


Private Sub Form_Load()

Dim Today As Date

Dim DayString As String

Dim PathString As String

Dim DateRec As Integer

Today = Now


PathString = App.Path

If Right(PathString, 1) <> "\" Then

PathString = PathString + "\"

End If

If Dir(PathString + "StartPc.log") <> "" Then

DateRec = FreeFile

Open PathString + "StartPc.log" For Input As #DateRec

Line Input #DateRec, DayString

Close #DateRec


Label1.Caption = "你上次开机是[" & DayString & "]"

Else

Label1.Caption = "你第一次使用本计算机"

End If


DateRec = FreeFile

Open PathString + "StartPc.log" For Output As #DateRec


DayString = Today

Print #DateRec, DayString


Close #DateRec

End Sub


上述程序略加修改并放入启动中即可实现对系统开机的记录。