Kod:
//
// 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;