📄 frmtest.frm
字号:
VERSION 5.00
Begin VB.Form frmTimerTest
BorderStyle = 1 'Fixed Single
Caption = "定时、延时函数大比拼"
ClientHeight = 1635
ClientLeft = 45
ClientTop = 330
ClientWidth = 5550
Icon = "frmTest.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1635
ScaleWidth = 5550
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdSleep
Caption = "Sleep 延时"
Height = 615
Left = 120
TabIndex = 1
Top = 915
Width = 2355
End
Begin VB.CommandButton cmdWaitTimer
Caption = "SetWaitableTimer 延时"
Height = 615
Left = 120
TabIndex = 0
Top = 180
Width = 2355
End
Begin VB.Label Label1
Caption = "用SetWaitableTimer函数定时可以很流畅的拖动窗口,而用Sleep函数时,会产生在延时期间窗口凝滞现象,这不是我们所想要的:)"
Height = 1260
Left = 2790
TabIndex = 2
Top = 240
Width = 2580
End
End
Attribute VB_Name = "frmTimerTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Download: http://www.codefans.net
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub cmdWaitTimer_Click()
Dim objTimer As clsWaitableTimer
Set objTimer = New clsWaitableTimer
cmdWaitTimer.Enabled = False
objTimer.Wait 5000 '5 秒
cmdWaitTimer.Enabled = True
Set objTimer = Nothing
End Sub
Private Sub cmdSleep_Click()
cmdSleep.Enabled = False
Sleep 5000 '5 秒
cmdSleep.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -