wait.bas

来自「一款基于VB的红外遥控系统」· BAS 代码 · 共 23 行

BAS
23
字号
Attribute VB_Name = "Pause"
'**************************************
'Windows API/Global Declarations for :A
'     simple Wait Function
'**************************************

Public Declare Function GetTickCount Lib "kernel32.dll" () As Long
'the api for detecting keys pressed or scan coded
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Public Function Wait(ByVal TimeToWait As Long) 'Time in seconds
    Dim EndTime As Long
    
    EndTime = GetTickCount + TimeToWait / 1 '* 1000 Cause u give seconds and GetTickCount uses Milliseconds

    Do Until GetTickCount > EndTime

        DoEvents
        
    Loop
        
End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?