Reputation: 279
I want to create a scheduled task on Windows using C. I reseached this topic and found the task scheduler interfaces provided by Microsoft. I was able to successfully create scheduled tasks using C++. However, due to limitations I can only use C for this and it seems that the interfaces are only provided for C++. I tried researching this but couldn't find any results. Is it possible to create scheduled tasks in Windows using C?
Upvotes: 1
Views: 1042
Reputation: 15164
It is possible to do COM in C but it is far uglier than with C++.
For example, if you look in mstask.h you will find macros like ITask_CreateTrigger following the definition of ITask. You can use those macros instead of C++ style member calls. With headers created from IDL it is generally a fairly mechanical task to transform C++ style COM code to C. If the interface is not generated from IDL then the C macros may well not be present but that is not an issue for the task scheduler API.
Upvotes: 3