Re: Displaying a message at specified time


[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by miscdas on August 29, 2002 at 11:41:14:

In Reply to: Re: Displaying a message at specified time posted by Rbrrneck on August 29, 2002 at 09:45:20:

: try puting this code in the timers on timer event:
: procedure TForm1.timer1timer(sendr:tobject);
: begin
: if TimeToStr(time)='12:00:00' then Showmessage('Cant belive it works , ypeee!');
: end;
: don't forget to add sysutils to the uses list, I suggest to put the timer to 800 miliseconds...


Why not make a little more complicated routine, so you don't have to check the time so much and use the CPU so often? First, get the current time. Next, subtract it from the target time. Now if this result is larger than some amount, like maybe 60 minutes, then set a timer to check again in 60 minutes. If the result is less than 60 minutes, then you could start running the timer at say every 600 milliseconds.

miscdas


Related Articles and Replies:


[ DelphiLand FAQ ] [ Delphi Tutorials ]