API Delphi

Question:
How do I create a delay without using a TTimer component,
and without locking up the system?
Answer:
Here is an example of using a loop that checks the time and
calls Application.ProcessMessages to allow Windows messages
to be processed during the loops execution.
procedure Delay(ms : longint);
var
TheTime : LongInt;
begin
TheTime := GetTickCount + ms;
while GetTickCount < TheTime do
Application.ProcessMessages;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('Start Test');
Delay(2000);
ShowMessage('End Test');
end;