Search Tools Links Login

A simple Wait Function


Visual Basic 6, or VB Classic

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

Original Author: PrixM

Assumptions

'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

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 123 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.