GetTickCount

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

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


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

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

你可能感兴趣的:(count)