VB - Three ways to pause your program
VB Code:
Sub Sleep(ByVal MillaSec As Long, Optional ByVal DeepSleep As Boolean = False)
Dim tStart#, Tmr#
tStart = Timer
While Tmr < (MillaSec / 1000)
Tmr = Timer - tStart
If DeepSleep = False Then DoEvents
Wend
End Sub
VB Code:
Declare Function GetTickCount Lib "kernel32" () As Long
Sub Pause(HowLong As Long)
Dim u%, tick As Long
tick = GetTickCount()
Do
u% = DoEvents
Loop Until tick + HowLong < GetTickCount
End Sub
VB Code:
'shortest
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Re: VB - Three ways to pause your program
7 way :the best(vb6 delay)pause,doevents(no need cpu)
http://www.vbforums.com/showthread.p...pu)&highlight=
Re: VB - Three ways to pause your program
1. 'shortest
2. Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds as Long)
you missed part of it
Re: VB - Three ways to pause your program
You don't need the "Alias" part unless your chosen name is different from the actual API function name.