随笔-244  评论-80  文章-1  trackbacks-3

GetTickCount

VB 利用Api函数GetTickCount计算Windows从启动后所运行的总时间 存在的问题..

[转贴 2006-01-29 02:37:06 ] 发表者: 半成品   


Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Timer1_Timer()
Dim Hour As Integer, Minute As Integer, Second As Integer


Hour = GetTickCount \ 1000 \ 60 \ 60
Label2.Caption = Str(Hour) & 小时

Minute = (GetTickCount - Hour * 60 * 60 * 1000) \ 1000 \ 60
Label3.Caption = Str(Minute) & 分

Second = (GetTickCount - Val(Minute)) \ 1000
Label4.Caption = Str(Second) & 秒

End Sub

注:
也可以将其放置一段代码的前后,来检测运行时间,其单位是毫秒级的

posted on 2006-05-24 10:31 kenty 阅读(2354) 评论(2) 编辑 收藏