2

I found here this C++ Code Example: Creating a Task Trigger https://msdn.microsoft.com/en-us/library/windows/desktop/aa446828(v=vs.85).aspx

Here we have:

pTrigger.wBeginDay =1;                  // Required
pTrigger.wBeginMonth =1;                // Required
pTrigger.wBeginYear =1999;              // Required
pTrigger.cbTriggerSize = sizeof (TASK_TRIGGER); 
pTrigger.wStartHour = 13;
pTrigger.TriggerType = TASK_TIME_TRIGGER_DAILY;
pTrigger.Type.Daily.DaysInterval = 1;

TriggerType is TASK_TRIGGER_TYPE.

typedef enum _TASK_TRIGGER_TYPE { 
TASK_TIME_TRIGGER_ONCE             = 0,
TASK_TIME_TRIGGER_DAILY            = 1,
TASK_TIME_TRIGGER_WEEKLY           = 2,
TASK_TIME_TRIGGER_MONTHLYDATE      = 3,
TASK_TIME_TRIGGER_MONTHLYDOW       = 4,
TASK_EVENT_TRIGGER_ON_IDLE         = 5,
TASK_EVENT_TRIGGER_AT_SYSTEMSTART  = 6,
TASK_EVENT_TRIGGER_AT_LOGON        = 7
} TASK_TRIGGER_TYPE, *PTASK_TRIGGER_TYPE;

but i want to trigger my consolle app every 5 minutes. Suggestions?

kenhero
  • 95
  • 2
  • 11
  • Start your program once and use an event to suspend it and re-start every 5 mins. The task scheduler can be used (abused) for what you want to do but it's not the best method. See also https://msdn.microsoft.com/en-us/library/windows/desktop/ms687012(v=vs.85).aspx – Richard Critten Jan 30 '17 at 00:07
  • I don't want to suspend my program,it needs to terminate regurally but i need to call it every 5 minute. I don't understand in TASK_TRIGGER_TYPE how to set under a daily trigger (i mean for example,every 2 hours or every 5 minutes). Thank you for reply – kenhero Jan 30 '17 at 00:49

0 Answers0