Link to home
Start Free TrialLog in
Avatar of Zarathushtra
Zarathushtra

asked on

Scheduled task programming

Hi,

I'm looking for a solution to a recurrent problem, the task scheduling system under windows. I want my application to execute a certain set of functions at a given moment in a week, every week. Like, every monday morning, I want to execute my own function "functionA()".

How should I do this? I am usually using C/C++ with or without the .NET framework.

One solution would be to implement a timer for like, 5 seconds and check the time every time the timer goes to zero, but that doesnt seem to be a great solution so if any of you have a good solution to that problem please let me know.

Also, I know about the windows task scheduler, but it only allows me to run compiled executables.
Avatar of rockiroads
rockiroads
Flag of United States of America image

Not sure where the problem lies

If u have a C program, you obviously have to compile it in order to run it
When compilled and linked u will end up with an exe
Why cant u use that in the windows task scheduler to run your own exe
function main() will simply call your functionA

Or do you want your program to run in the background all the time, hence why you mentioned using timers.
Avatar of Zarathushtra
Zarathushtra

ASKER

Suppose that monday, i want to run "functionA()" and tuesday, "functionB()"
the task scheduler would go something like
ON Monday, run "myProgram.exe functionA"
ON tuesday, run "myProgram.exe functionB"

wouldnt that create overly messy code?
I was originaly looking for a program running in the background all the time, but I don't have a lot of experience dealing with elapsed time and durations in C/C++

I did it once in VB 6 with timers but it wasnt very nice since I had to reset the timer every second or so to get good precision.
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial