Quick question .. If you wanted a timed (in program) event to take place on Feb 15th at 3pm , how would you achieve this ?

Comments

  1. You could create a task for the Windows task scheduler. JCL has the API translation as well as a wrapper class.

    ReplyDelete
  2. Thank you Ondrej Kelle  .

    I can see that Windows Task scheduler can be used to call and execute individual programs 

    What if there was more than one event and the actual event code was embedded in the program ?

    ReplyDelete
  3. Just an idea: you could set up each event as a separate task scheduled to launch your program with a different command line parameter. Your program could then respond differently, based on this parameter.

    ReplyDelete
  4. Thank you Ondrej Kelle , I will try that approach :)

    ReplyDelete
  5. Welcome Steven Healey , I'm glad to help. :-)

    ReplyDelete
  6. Thank you Stefan Glienke , I will investigate Cromis too. Downloading the components and demo now

    ReplyDelete
  7. Steven Healey , Ondrej Kelle - Be aware that I've recently run into problems with the JEDI task scheduler. It only implements V1.0 of the task scheduler interface. This is deprecated but available in Windows 7. However, it is not available in Windows 8 and will throw an error if you try to create a task.

    ReplyDelete
  8. Paul Thornton Thanks for the heads-up.

    ReplyDelete
  9. You could also write a little daemon like program which is started by the windows scheduler at the desired moment. This little program just look if your main app is running. If not it starts it and then sends a message to it.
    You could also extend this system by writing a process which looks in a data base if there where some events scheduled and then sends messagges at the desired time. You could achieve this with a timer which fires i.e. every our, or every minute if you want to be able to schedule events on a minute base.

    ReplyDelete
  10. Thank you Klaus Edelmann for more good ideas , which is why I love this community :)

    ReplyDelete
  11. In Windows i'd write a service, have it installed together with the program/application and let the two communicate. Kind of the same approach as Klaus suggested.

    ReplyDelete
  12. About Windows Task Scheduler, here's what I've found out: JCL only provides a wrapper (JclTask.pas) to the old API (MsTask.pas) from mstask.dll. Using this old/deprecated API seems to produce runtime errors on Windows 8. The new API is again an automation server, deployed in taskschd.dll. It doesn't seem to register its type library so it's not visible in Delphi's import type library dialog, but you can extract the type library resource from the dll to hard disk and use tlibimp.exe to generate the Delphi import unit.

    ReplyDelete

Post a Comment