VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Pause

by Shawn Neckelmann (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

Tired of having to pause in increments of 1 second? This coding will pauses based on MILLIseconds using the GetTickCount function.

Inputs
The number of seconds to pause for. You can put this value down to as little as a millisecond.
Assumes
Use the CDbl type converter to avoid getting an Invalid Parameter Type error. Ex: dim lngPause as Long lngPause = 2 Call Pause(CDbl(lngPause))
Code Returns
0
Side Effects
0
API Declarations
Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long 'this is for 32-bit versions of VB
'Declare Function GetTickCount& Lib "user" () 'this one is for 16-bit versions

Rate Pause

Sub Pause (ByVal hInterval As Double)
Dim hCurrent As Long
hInterval = hInterval * 1000
hCurrent = GetTickCount()
Do While GetTickCount() - hCurrent < hInterval
  DoEvents
Loop
End Sub

Download this snippet    Add to My Saved Code

Pause Comments

No comments have been posted about Pause. Why not be the first to post a comment about Pause.

Post your comment

Subject:
Message:
0/1000 characters