[求助]用VB写一计时程序
我想用VB写一计时程序,能够统计一段时间里开机的时间总量.请帮忙解决一下!
Private Sub Form_Load() 'load事件要写,不然会停顿1s才显示
Formattime (GetTickCount)
End Sub
Private Sub Timer1_Timer()
Formattime (GetTickCount)
End Sub
F Private Function Formattime(GetTickCount As Long) As String '将时间转换成hh:mm:ss格式
Dim hour, min, sec
hour = GetTickCount / 3600000
min = hour - Int(hour)
min = 60 * min
sec = min - Int(min)
sec = 60 * sec
hour = Int(hour)
min = Int(min)
sec = Int(sec)
gettime = Format(hour, "00") & ":" & Format(min, "00") & ":" & Format(sec, "00")
Me.Caption = "系统已运行:" & gettime
End Function
[此贴子已经被作者于2005-11-25 13:03:00编辑过]