VBGamer |
|
GetTickCount Rag on a Stick (0 replies, 0 views) (2000-Jul-9) I'll be that somebody :)
Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
What it does is it returns the time since windows was started (or something usless like that) in milliseconds (i.e. 1000 to a second). Using it is often done like this:
Const cstSpeed = 100 '(Time in milliseconds)
Dim LastTick As Long
Dim Exiting As Boolean
Exiting = False
Do While Not Exiting
If GetTickCount - LastTick > cstSpeed Then
LastTick = GetTickCount
DoStuff
End If
DoEvents
Loop
In case you are wondering what DoEvents does, it gives windows a chance to do it's own thing (like drawing the mouse pointer or checking the keyboard). Without it, your program will probably be a dud because Windows handles most things like input and stuff. Just use it :) MSDN can explain it better than I can.
|