VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Time Delay Function

by SeonJong,CHOI (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (6 Votes)

It is method that delay time as much as time that designate.
There is no problem even if use over midnight.
With Sleep function, use and lowered CPU's use rate.

API Declarations
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Rate Time Delay Function

Public Sub Delay(ByVal delayTime As Single)
  Dim startTime  As Single
  Dim LoopTime  As Single
  
  startTime = Timer
  Do
    Call Sleep(50)
    
    If Timer < startTime Then startTime = startTime - 86400
    
    LoopTime = Timer - startTime
    DoEvents
  Loop Until delayTime < LoopTime
End Sub

Download this snippet    Add to My Saved Code

Time Delay Function Comments

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

Post your comment

Subject:
Message:
0/1000 characters