1

I would like to execute a method at a given time (e.g. every day at 7 PM). My first idea was to check the current TDateTime every second with a TTimer, but it is not thread safe. How should I do this?

Oh nooo
  • 478
  • 5
  • 19
  • 1
    http://stackoverflow.com/questions/8319461/delphi-alarm-clock-like-application – fantaghirocco Sep 24 '15 at 08:41
  • 3
    I would use the OS and a scheduled task – mjn Sep 24 '15 at 08:41
  • An alternative to use if you need to do this in an existing service is to use waitable timers - see https://msdn.microsoft.com/en-us/library/windows/desktop/ms687008%28v=vs.85%29.aspx for basics. There is a Delphi example by Remy at http://embarcadero.newsgroups.archived.at/public.delphi.language.delphi.win32/201102/11020811353.html – Gerry Coll Sep 24 '15 at 22:01

1 Answers1

4

I would use the OS and configure a scheduled task which launches the Delphi application at the given time.

mjn
  • 36,362
  • 28
  • 176
  • 378