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

王朝厨房·作者佚名  2007-01-04
宽屏版  字体: |||超大  

作者:徐建波

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有