Public Sub Delay(Sec As Long)
Dim TStart As Single, t As Single, t0 As Integer
TStart = Timer
While t <Sec
t = Timer - TStart
If Int(t) <>t0 Then
t0 = Int(t)
Text2.Text = Sec - t0
End If
DoEvents
Wend
End Sub
自定义一个函数: Private Const KEYEVENTF_KEYUP = &H2Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub Pause(ByVal sSec As Long)
Dim StartSec As Long
StartSec = GetTickCount()
While (GetTickCount() - StartSec) <sSec
DoEvents
Wend
End Sub这样Pause(50)就可以延迟50毫秒、Pause(1000)就可以延迟1秒,()里面的数字可以随便写,单位是毫秒,1秒=1000毫秒。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)