Re: Displaying a message at specified time


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

Posted by Met@ on August 27, 2002 at 20:24:13:

In Reply to: Re: Displaying a message at specified time posted by Marconi on August 27, 2002 at 19:22:45:

: : : : Hey everybody!

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

: Try it

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

: I believe it work

: 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?
The code is:


unit Klok;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.Timer1Timer(Sender:TObject);
begin
if time=StrToTime('20:28') then begin
ShowMessage('Time to go to Bed');
end;
end;

end.

 

Met@


Related Articles and Replies:


[ DelphiLand FAQ ] [ Delphi Tutorials ]