显示当前系统的启动时间
在窗体中添加Label和Timer控件;
在代码编辑器中添加如下代码:
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub Form_Load()
Label1.Caption = ""
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim seconds As Long
Dim minute As Long
Dim hour As Long
hour = GetTickCount 1000 60 60
minute = (GetTickCount - hour * 60 * 60 * 1000) 1000 60
seconds = (GetTickCount - hour * 60 * 60 * 1000 - minute * 60 * 1000) 1000
Label1.Caption = "当前系统已启动:" & hour & "小时" & minute & "分" & seconds & "秒"
End Sub
界面的设计:
显示当前系统启动的时间(vb6.0)
运行结果:
显示当前系统启动的时间(vb6.0)
发布于 2016-10-13 22:04