Public Declare Sub Sleep Lib "kernel32" _
Alias "Sleep" (ByVal dwMilliseconds As Long) 'DoEvents does this: 'While (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { ' TranslateMessage(&msg); ' DispatchMessage(&msg); ' } 'DoEvents spends part of its time watching For other 'messages in the same process. This behavior has no 'value in a preemptive-multitasking operating system. 'Sleep yields more efficiently to other processes. 'and can be called as: Sleep 0& |