Search code examples
delphidelphi-xe2delphi-2010

How to handle OnTimer event in Delphi XE2?


I need to show a message say "Hi" everyday at 9 AM. Do I require Timer for this? How can I check whether its 9 AM or not. What should be the interval of timer at which OnTimer event run?

procedure Form1.TimerTimer1(Sender: TObject);
begin
  ShowMessage("Hi");
end;

If I run this event in after 24 hours, I fear it might pass 9 AM and will not fire.


Solution

  • Unless you have other valid reasons, it's far more easier to

    • write a simple application that shows the message and quits
    • schedule it to run using the task scheduler of Windows

    enter image description here