README.md

December 4, 2022 ยท View on GitHub

A simple Wait Function

Description

Ur code waits for X seconds without stopping complete VB like most others (incl. Sleep Api)

More Info

'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

Submitted On
ByPrixM
LevelBeginner
User Rating4.3 (39 globes from 9 users)
CompatibilityVB 4.0 (32-bit), VB 5.0, VB 6.0
CategoryVB function enhancement
WorldVisual Basic
Archive File

API Declarations

Public Declare Function GetTickCount Lib "kernel32.dll" () As Long

Source Code

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