Advertisement
2002C Miscellaneous #8753

TimeDelay

TimeDelay fuction is good for when you want to time out a loop, in milliseconds. Does'nt use a timer control, Uses simple api declare.

AI

KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Quellcode
original-source

Public Function TimeDelay(ByVal Delay As Long) As Boolean
Static Start As Long
Dim Elapsed As Long
If Start = 0 Then                            'if start is 0 then set a
  Start = GetTickCount                       'Static value to compare
End If
Elapsed = GetTickCount
If (Elapsed - Start) >= Delay Then
  TimeDelay = True
  Start = 0                            'Remember to reset start
Else: TimeDelay = False                 'once true so subsquent
End If                                'calls wont "spoof" on you!
End Function
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine