Board index » delphi » Launch a task at midnight ?

Launch a task at midnight ?

Hi,

Can somebody tell me how to launch a task at midnight in my Delphi
application (generate an event for example) ?

Has somebody a sample source code to make this ?

Thanks.

 

Re:Launch a task at midnight ?


On Mon, 13 Dec 1999 12:43:33 +0100, "Manuel De Carvalho"

Quote
<mdecarva...@ametis-tm.com> wrote:
>Hi,

>Can somebody tell me how to launch a task at midnight in my Delphi
>application (generate an event for example) ?

>Has somebody a sample source code to make this ?

You have to check Time , if it's midnight then do something.
You can use for it TTimer and Time()
Or just use loop repeat..until and check if it's midnight (or past
midnight)

Shamrock

Re:Launch a task at midnight ?


Try somthing with this :

var
  AlarmTijd : TTime;
begin
  Alarmtijd := ...
  Timer1.Interval:= Round((Alarmtijd-Now)*24*60*60*1000);
  Timer1.Enabled:=True;
end;

I'm not a pro, so if someone knows something is wrong with
this ... let us know.

greetings
BAS.

* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful

Re:Launch a task at midnight ?


Nothing is wrong with the code displayed here (in D5), but if are you trying
to set AlarmTijd to TimeToStr('24:00:00') you will have a problem. What you
might want to do is set the interval to 1000 and in the OnTimer() routine
you will then have to test if it is the appropriate time to kick of the
task.

Quote
BAS wrote in message <184874d0.b8099...@usw-ex0109-070.remarq.com>...
>Try somthing with this :

>var
>  AlarmTijd : TTime;
>begin
>  Alarmtijd := ...
>  Timer1.Interval:= Round((Alarmtijd-Now)*24*60*60*1000);
>  Timer1.Enabled:=True;
>end;

>I'm not a pro, so if someone knows something is wrong with
>this ... let us know.

>greetings
>BAS.

>* Sent from AltaVista http://www.altavista.com Where you can also find

related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is
Beautiful

Other Threads