Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Enumerating Tasks Example

To enumerate tasks, you must call ITaskScheduler::Enum to create an enumeration object. Then, use the enumeration object's IEnumWorkItems interface to enumerate the tasks in the Scheduled Tasks folder.

The following procedure describes how to enumerate the tasks in the Scheduled Tasks folder.

Aa446881.wedge(en-us,VS.85).gifTo enumerate the tasks in the Scheduled Tasks folder

  1. Call CoInitialize to initialize the COM library and CoCreateInstance to get a Task Scheduler object. (This example assumes that the Task Scheduler service is running.)
  2. Call ITaskScheduler::Enum to get an enumeration object.
  3. Call IEnumWorkItems::Next to retrieve the tasks. (This example tries to retrieve five tasks with each call.)
  4. Process the tasks returned. (This example simply prints the name of each task to the screen.
  5. Release resources. Call CoTaskMemFree to free the memory used for names.
For a code example ofSee
Enumerating all the tasks in the Scheduled Tasks folder of the local computer C/C++ Code Example: Enumerating Tasks

 

Related topics

Task Scheduler 1.0 Examples

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.