Platform SDK: Task Scheduler |
The SetTrigger method sets the trigger criteria for a task trigger.
HRESULT SetTrigger( const PTASK_TRIGGER pTrigger );
The SetTrigger method returns one of the following values.
Value | Description |
---|---|
S_OK | The operation was successful. |
E_INVALIDARG | The arguments are not valid. |
E_OUTOFMEMORY | Not enough memory is available. |
The wBeginDay, wBeginMonth, and wBeginYear members of the TASK_TRIGGER structure must be set to a valid day, month, and year respectively.
A task can have any number of triggers associated with it. The times that the task will run are the union of all the triggers defined for that task.
To update the task with these new trigger settings, applications must call the IPersistFile::Save method after calling SetTrigger.
The following code shows the variable declaration and calling syntax for this method, including the required members of TASK_TRIGGER.
TASK_TRIGGER pTrigger; ZeroMemory(&pTrigger, sizeof (TASK_TRIGGER)); pTrigger.wBeginDay =1; pTrigger.wBeginMonth =1; pTrigger.wBeginYear =1999; hr = pITaskTrigger->SetTrigger(&pTrigger); pITaskTrigger->Release
For a complete example of | See |
---|---|
Setting the trigger criteria when creating a new trigger | Creating a New Trigger |
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later).
Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later).
Header: Declared in mstask.h.
Unicode: Defined only as Unicode.
IPersistFile::Save, ITaskTrigger, ITaskTrigger::GetTrigger, TASK_TRIGGER