2

I am started working on Windows10 Task Scheduler .

I am developing GUI application in that I have requirement to control the number of days interval for trigger the task.

Suppose If I enter 5 days in my GUI then it should trigger the task in 5 days. Likewise randomly user can change the days.

Currently I have a task which is already exists in the task Scheduler, in that I need to control the days for to trigger in the User Interface.

I have seen the examples of Task Scheduler in MSDN but all of them are related to creating a new task or retrieving the states of existing task.

I don't want to create a new task , I want to edit the existing same task every time.

I didn't find anything which is related to editing the task which is already present in Task Scheduler.

Requesting anyone to please help me in editing the time trigger days in C++ using Task Scheduler 2.0.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621

1 Answers1

4

Seems like what you can do is get access to all the ITrigger instances that are defined for a given task. These provide you with a pretty straightforward interface through which you set trigger times/limits/repetitions etc. for the task.

You access these trigger objects through the ITaskDefinition's get_Triggers() method, which returns an ITriggerCollection which you can iterate to find your trigger. You get the ITaskDefinition object by callng IRegisteredTask's get_Definition() method. You get the IRegisteredTask object by calling ITaskFolder's GetTask() method. An instance of which, to begin with, you get by calling ITaskService's GetFolder() method. Few. Thank MS for this idea of an API.

If you need basic help finding headers and running code then there's a code example at the bottom of this documentation page that does something different than what you are requesting (it creates a new task, not accessing an existing one), but can provide you with all the necessary boilerplate snippets to get going.

Geezer
  • 5,600
  • 18
  • 31