GarryLaly

Delay Function without Sleep Freeze

Apr 20th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.35 KB | None | 0 0
  1. 'Credit to Ashkore Dracson
  2. Sub Delay(ByVal dblSecs As Double)
  3.     Const OneSec As Double = 1.0# / (1440.0# * 60.0#)
  4.     Dim dblWaitTil As Date
  5.     Now.AddSeconds(OneSec)
  6.     dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(dblSecs)
  7.     Do Until Now > dblWaitTil
  8.     Application.DoEvents() ' Allow windows messages to be processed
  9.     Loop
  10. End Sub
Add Comment
Please, Sign In to add comment