Re: Displaying a message at specified time


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

Posted by Marconi on August 28, 2002 at 19:14:48:

In Reply to: Re: Displaying a message at specified time posted by Met@ on August 28, 2002 at 18:39:40:

: : : : : : : : I've got a question :D I want my program to display a message at a specified time; e.g. every day at 12.00 pm, the program displays a message: "Time to go to bed!" Is this possible? If yes: how?

: : : : : : : You can put a timer object in your application, that's check the time of your computer every minute, and send the message when you want. Is important to set the timer interval to 60000 miliseconds in this case. If these number is to low your aplication will be very slow.

: : : : : : Erm...about the solution you gave me...I thought of that before, but I didn't know the code! Can you help me with the code? Cuz....I don't know how to put a "time check" in my application and I don't know how I can let it trigger my message!

: : : : : : Met@

: : : : : procedure TForm1.Timer1Timer(Sender: TObject);
: : : : : begin
: : : : : if time=StrToTime('00:00') then begin
: : : : : ShowMessage('Time to go to Bed');
: : : : : // more code .... if you desire
: : : : : end;
: : : : : end;

: : : : : Marconi

: : : : TNX! Erm......I got it to work, but it won't display a message! DOES it "grab" my pc time? If not: how can I get the program to "grab" my pc time?
: : : : Met@

: : : I don't urdestand english very well. I know what is a grab (animal), but what you mean with "grab a computer"?

: : : To set it off You can call the program "C:\WINDOWS\RUNDLL.EXE user.exe,exitwindows"

: : : To freeze it, You can remane the extension of any "txt" file to "exe" and try to execute it.

: : : You can see is this page why to run another exe file.

: : : if the message is not displayed you can try this
: : : ....
: : : if Copy(TimeToStr(time),1,5)='20:28' then begin
: : : ....

: : : Marconi

: : Hi! Tnx for your reply! Erm...with "grabbing my computer's time", I mean that the program erm............looks what time it is at your computer. So my question is: does the code you gave me look at my computer's time and then displays a message at the specified time?

: : Met@

: Oh, BTW....it still doesn't work :(

: Met@

Perhaps the time mask of your computer is different of mine. So put the follow code ..

ShowMessage(TimeToStr(time));

to see the apropriate mask to use in the "IF"

Maybe '23.10' instead of '23:10'. Or another, who knows ?

Good Luck

Marconi


Related Articles and Replies:


[ DelphiLand FAQ ] [ Delphi Tutorials ]