首页 | 社区 | 博客 | 招聘 | 文章 | 新闻 | 下载 | 读书 | 代码
亲,您未登录哦! 登录 | 注册

利用Api函数计算Windows从启动后所运行的总时间

打印文章

分享到:
作者:徐建波

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

Private Sub Timer1_Timer()
Dim hour As Integer
Dim minute As Integer
Dim second As Integer
hour = GetTickCount \ 1000 \ 60 \ 60
Label1.Caption = Str(hour) + "小时"

minute = (GetTickCount - hour * 60 * 60 * 1000) \ 1000 \ 60
Label2.Caption = Str(minute) + "分钟"

second = (GetTickCount - Val(Label1.Caption) * 60 * 60 * 1000 - Val(Label2.Caption) * 60 * 1000) \ 1000
Label3.Caption = Str(second) + "秒钟"
End Sub

本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( Pfan.cn )

编程爱好者论坛

本栏最新文章