Private Declare Function GetTickCount&
Lib "kernel32" ()
Private Sub Form_Load()
'load事件要写,不然会停顿1s才显示Formattime (GetTickCount)
End SubPrivate Sub Timer1_Timer()
Formattime (GetTickCount)
End SubF 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编辑过]