VERSION 1

 

From: Nivaldo Fernandes <n.fernandes@conservation.org>

Subject: Delay

Date: Sun, 14 May 95 08:11:36 -0700

 

This is an equivalent to the Delay procedure in Borland Pascal. You may

find it of interest. It is not mine. It was given to me by someone else

who did not cite the source. Hope it helps your important WWW page. Take

care.

 

procedure TForm1.Delay(msecs:integer);

var

   FirstTickCount:longint;

begin

     FirstTickCount:=GetTickCount;

     repeat   

           Application.ProcessMessages; {allowing access to other

                                         controls, etc.}

     until ((GetTickCount-FirstTickCount) >= Longint(msecs));

end;

 

 

______________________

 

//Other source:

 

 

VERSION 2

 

 

How to put a delay

Looking for a way to delay the execution of your program? Well, delay() function is gone, but Sleep() and SleepEx() Windows functions are here to stay:

 

For example, if you want to delay your program execution for 10 seconds, call Windows API function Sleep() with 10*1000 (convert seconds to milliseconds):

 

Sleep( 10000 );

 

 

// Other source

 

VERSION 3

 

{$R *.DFM}

procedure Delay(ms : longint);

{$IFNDEF WIN32}

var

  TheTime : LongInt;

{$ENDIF}

begin

{$IFDEF WIN32}

  Sleep(ms);

{$ELSE}

  TheTime := GetTickCount + ms;

  while GetTickCount < TheTime do

    Application.ProcessMessages;

{$ENDIF}

end;

 

(*dalej np. button1click,

 begin

 delay (1000);

 instrukcja;

 end;*)