📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "确定Windows运行的时间"
Height = 615
Left = 1320
TabIndex = 0
Top = 2040
Width = 2295
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' GetTickCount函数声明
Private Declare Function GetTickCount Lib "kernel32" () As Long
Public Sub GetRunTime()
Dim RunTime As Long
Dim Hour As Integer ' 时
Dim Minute As Integer ' 分
Dim Second As Integer ' 秒
'
'获得总共运行的秒数
RunTime = GetTickCount() \ 1000
'获得运行的小时数
Hour = RunTime \ 3600
'获得分数
RunTime = RunTime - 3600 * Hour
Minute = RunTime \ 60
'获得秒数
Second = RunTime - 60 * Minute
MsgBox "Windows运行的时间是:" + Str(Hour) + "小时" + Str(Minute) + "分钟" + Str(Second) + "秒"
End Sub
Private Sub Command1_Click()
GetRunTime
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -