Basic class for using the Microsoft Task Scheduler

Microsoft developed a full-featured scheduler for IE 4, IE 5, Win 98, and NT 5. From looking at all the task
options available (three property pages, plus an "advanced" dialog) you could imagine that programming
the scheduler is quite a chore. And you’d be right. I developed the CScheduledTask class to help you create very
simple tasks and understand the basics of using the scheduler.

[Sample scheduled task - 5K]


  • Fixed some compile errors when building for Unicode. Thanks to Chris Maunder for providing the fixes!
  • Fixed SaveTask() to properly check for an existing task. The change was necessary because I worked around a
    bug in IE 4, but the bug was fixed in IE 5, resulting in my code breaking when run on IE 5.
  • Added a #pragma to automatically link with mstask.lib, so you don’t have to remember to do that in
    your app’s project settings.
  • Added a check after the CoCreateInstance() call to see if the error is REGDB_E_CLASSNOTREG. If so, I display
    a nicer trace message explaining that you don’t have the scheduler installed.

Demo project


Take the link below to download a demo project that illustrates using the CScheduledTask class.

Download demo project – 33KB

Download source – 9K

Date Last Updated: April 24, 1999

More by Author

Must Read