by PrixM (2 Submissions)
Category: VB function enhancement
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (9 Votes)
Ur code waits for X seconds without stopping complete VB like most others (incl. Sleep Api)
Assumes
'Set the API Declaration and the Code into a Module
'to use the function Wait(x) x stands for the amount of seconds to wait
API DeclarationsPublic Declare Function GetTickCount Lib "kernel32.dll" () As Long
Public Function Wait(ByVal TimeToWait As Long) 'Time in seconds
Dim EndTime As Long
EndTime = GetTickCount + TimeToWait * 1000 '* 1000 Cause u give seconds and GetTickCount uses Milliseconds
Do Until GetTickCount > EndTime
DoEvents
Loop
End Function