Scheduled task

nate

Freshman
Joined
Dec 2, 2006
Messages
36
I need to impliment a scheduler in my program. Basically if someone selects to do something at a certain time I want it to run my code. My question is, do I need to run a timer control and constatnly check datestring and timestring? Or is there an easier way of doing it? Thanks in advance.
 
Heres a few (but there are more out there)

1-Programs can run in the background (kinda like an IM app that only shows its icon on the bottom right of the screen). You can have them start up when windows starts up

2-Install as a service, and have your service run automatically (again, when windows starts up).


What do you see would be the simplest way of getting your app working?
 
You will need to have a program run in the background one way or another in order to do this. You could use a "lightweight" program that runs using either of the aforementioned techniques (the former is probably best since it would allow you to have a notify/system tray icon). This program could implement the scheduling interface and when a scheduled event occurs, it could run the program that will handle the scheduled event. Or you could incorporate it all into one application, although this would likely require more resources while it sits idle in the background.

As far as how you go about timing the scheduled events, using a timer would be one option (probably the least desirable, but I suppose it is a viable option). Off the top of my head, I can't think of any other great suggestions. You might want to consider looking for something along the lines of the Application.Idle event (although that, specifically, is not what you are looking for). Some sort of WinAPI action might be due.
 
You know there's a windows event scheduler already built into the OS, right? If this implementation isn't just for academics, why not take advantage of that?
 
I used to use a servers event scheduler to push/pull data from remote SQL DBs. I could set up the event to run at 1 am so it had full use of down time. I have also set up auto fax blasters that run off a scheduler late at night. To set it up you just tell it what exe to run, when and how often. If you use this approach setting up error logging is critical to figuring out problems that might occur when you are not around.

MT
 
Thanks for the input. My app does start at windows start and runs in the systray. I could use the timer but it isn't reliable. I simply want to use the task scheduler, I just have never used it. I created this post on the sister site. I have found some code but it seems buggy. I can't seem to find a good solid way of doing it. mskeel, I would prefer to use that just can't seem to get it to work. If you have done this successfully can you please help? THanks again.
 
Start->control panel->performance and maintenance->scheduled tasks (or skip performance and maintenance if you are in classic view)

Double click "Add Scheduled Task" and a wizard will prompt you through the rest. I've got several automated tasks running right on schedule -- no problems.
 
Back
Top