VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A simple Wait Function

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 Declarations
Public Declare Function GetTickCount Lib "kernel32.dll" () As Long

Rate A simple Wait Function

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

Download this snippet    Add to My Saved Code

A simple Wait Function Comments

No comments have been posted about A simple Wait Function. Why not be the first to post a comment about A simple Wait Function.

Post your comment

Subject:
Message:
0/1000 characters