Title: Pascal based Delay function
Question: What can we do with Delphi to wait x milliseconds without using a timer ???
Answer:
//---------------------------------------------------------------------------
// Author : Digital Survivor [Esteban Rodrguez Nieto | Jos Plano]
// Email : plmad666@gmail.com | jose.plano@gmail.com
// Web site : www.ds-studios.com.ar
//---------------------------------------------------------------------------
{ This simple procedure uses a Windows' function
called "GetTickCount". This function returns the millisecons that
Windows was started. We can use this to wait x millisecons before
continue with anothe process. }
Procedure TForm1.Delay (Msecs : Integer);
Var
FirstTickCount : LongInt;
Begin
FirstTickCount := GetTickCount;
Repeat
Application.ProcessMessages; // This procedure process another Windows' Messages and avoids the form stop responding.
Until ((GetTickCount - FirstTickCount) = LongInt (Msecs));
End;