The function Delay() allows access to other events during the delay. For instance a certain key could be used to interrupt a lenghty delay. The Win32 API function Sleep() ignores events, maybe it should be called DeepSleep().
// // delay in milliseconds, uses the system time, also uses // Application.ProcessMessages, which allows access to other events // during the delay, the Win32 API function Sleep() does not // procedure Delay(msecs: integer); var FirstTickCount: longint; begin FirstTickCount := GetTickCount; repeat Application.ProcessMessages; until ((GetTickCount-FirstTickCount) >= Longint(msecs)); end;
Edited 5 Years Ago by tucode: wrong title