ITriggerCollection::Create method

Creates a new trigger for the task.

Syntax


HRESULT Create(
  [in]  TASK_TRIGGER_TYPE2 type,
  [out] ITrigger           **ppTrigger
);

Parameters

type [in]

This parameter is set to one of the following TASK_TRIGGER_TYPE2 enumeration constants.

ValueMeaning
TASK_TRIGGER_EVENT
0

Triggers the task when a specific event occurs.

TASK_TRIGGER_TIME
1

Triggers the task at a specific time of day.

TASK_TRIGGER_DAILY
2

Triggers the task on a daily schedule. For example, the task starts at a specific time every day, every-other day, every third day, and so on.

TASK_TRIGGER_WEEKLY
3

Triggers the task on a weekly schedule. For example, the task starts at 8:00 AM on a specific day every week or other week.

TASK_TRIGGER_MONTHLY
4

Triggers the task on a monthly schedule. For example, the task starts on specific days of specific months.

TASK_TRIGGER_MONTHLYDOW
5

Triggers the task on a monthly day-of-week schedule. For example, the task starts on a specific days of the week, weeks of the month, and months of the year.

TASK_TRIGGER_IDLE
6

Triggers the task when the computer goes into an idle state.

TASK_TRIGGER_REGISTRATION
7

Triggers the task when the task is registered.

TASK_TRIGGER_BOOT
8

Triggers the task when the computer boots.

TASK_TRIGGER_LOGON
9

Triggers the task when a specific user logs on.

TASK_TRIGGER_SESSION_STATE_CHANGE
11

Triggers the task when a specific session state changes.

 

ppTrigger [out]

An ITrigger interface that represents the new trigger.

Pass in a reference to a NULL ITrigger interface pointer. Referencing a non-NULL pointer can cause a memory leak because the pointer will be overwritten.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Taskschd.h

Library

Taskschd.lib

DLL

Taskschd.dll

See also

ITriggerCollection
Task Scheduler

 

 

Show: