Re: Displaying a message at specified time

[ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by Met@ on August 29, 2002 at 13:30:39:

In Reply to: Re: Displaying a message at specified time posted by miscdas on August 29, 2002 at 11:41:14:

: : 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

OMG! IT WORKS! TNX A BUNCH! So that was the problem...I wrote the time like this: '12:00'. It schould have been '12:00:00' LOL TNX FOR ALL YOUR HELP GUYS!


PS I'm gonna try that one, miscdas!

[ DelphiLand FAQ ] [ Delphi Tutorials ]