Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

ITaskTrigger (Interfaces)
 
.
Summary
Part of the Task Scheduler 1.0 Interfaces, which consists of IEnumWorkItems, ITask, ITaskScheduler, ITaskTrigger and IScheduledWorkItem. The C# definition contains some helper code. Not all methods have been tested, so be careful!
Summary
There is some helper code in ITask, for encapsulating the use of IEnumWorkItems, creating the TASK_TRIGGER structure (used by ITaskTrigger), and creating ITaskScheduler. Not all methods have been tested, so be careful!

C# Definition:

    [Guid("148BD52B-A2AB-11CE-B11F-00AA00530503"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ITaskTrigger
    {
    int SetTrigger( ref TASK_TRIGGER pTrigger);
    int GetTrigger( ref TASK_TRIGGER pTrigger);
    int GetTriggerString([MarshalAs(UnmanagedType.LPWStr)] out string wszTrigger);
    };

    public 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
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct TASK_TRIGGER
    {
    [MarshalAs(UnmanagedType.U2)] public ushort        cbTriggerSize;
    [MarshalAs(UnmanagedType.U2)] public ushort        Reserved1;
    [MarshalAs(UnmanagedType.U2)] public ushort        wBeginYear;
    [MarshalAs(UnmanagedType.U2)] public ushort        wBeginMonth;
    [MarshalAs(UnmanagedType.U2)] public ushort        wBeginDay;
    [MarshalAs(UnmanagedType.U2)] public ushort        wEndYear;
    [MarshalAs(UnmanagedType.U2)] public ushort        wEndMonth;
    [MarshalAs(UnmanagedType.U2)] public ushort        wEndDay;
    [MarshalAs(UnmanagedType.U2)] public ushort        wStartHour;
    [MarshalAs(UnmanagedType.U2)] public ushort        wStartMinute;
    [MarshalAs(UnmanagedType.U4)] public uint          MinutesDuration;
    [MarshalAs(UnmanagedType.U4)] public uint          MinutesInterval;
    [MarshalAs(UnmanagedType.U4)] public uint          rgFlags;
    [MarshalAs(UnmanagedType.U4)] public TASK_TRIGGER_TYPE TriggerType;
    [MarshalAs(UnmanagedType.U2)] public ushort        item1;
    [MarshalAs(UnmanagedType.U2)] public ushort        item2;
    [MarshalAs(UnmanagedType.U2)] public ushort        item3;
    [MarshalAs(UnmanagedType.U2)] public ushort        item4;
    [MarshalAs(UnmanagedType.U2)] public ushort        Reserved2;
    [MarshalAs(UnmanagedType.U2)] public ushort        wRandomMinutesInterval;
    [MarshalAs(UnmanagedType.U2)]     public ushort          cbTriggerSize;
    [MarshalAs(UnmanagedType.U2)]     public ushort          Reserved1;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wBeginYear;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wBeginMonth;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wBeginDay;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wEndYear;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wEndMonth;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wEndDay;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wStartHour;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wStartMinute;
    [MarshalAs(UnmanagedType.U4)]     public uint        MinutesDuration;
    [MarshalAs(UnmanagedType.U4)]     public uint        MinutesInterval;
    [MarshalAs(UnmanagedType.U4)]     public uint        rgFlags;
    [MarshalAs(UnmanagedType.U4)]     public TASK_TRIGGER_TYPE   TriggerType;
    [MarshalAs(UnmanagedType.U2)]     public ushort          item1;
    [MarshalAs(UnmanagedType.U2)]     public ushort          item2;
    [MarshalAs(UnmanagedType.U2)]     public ushort          item3;
    [MarshalAs(UnmanagedType.U2)]     public ushort          item4;
    [MarshalAs(UnmanagedType.U2)]     public ushort          Reserved2;
    [MarshalAs(UnmanagedType.U2)]     public ushort          wRandomMinutesInterval;

    public ushort DaysInterval      { get { return item1; } set { item1 = value; } }
    public ushort WeeksInterval     { get { return item1; } set { item1 = value; } }
    public ushort rgfDaysOfTheWeek  { get { return item2; } set { item2 = value; } }
    public ushort wWhichWeek    { get { return item1; } set { item1 = value; } }
    public ushort rgfMonths     { get { return item3; } set { item3 = value; } }
    public uint   rgfDays       { get { return ((uint)item1 <<  0) |
                               ((uint)item2 << 16);           }
                      set { item1 = (ushort)((value >>  0) & 0xFFFF);
                        item2 = (ushort)((value >> 16) & 0xFFFF); }}

    static public TASK_TRIGGER CreateInstance()
    {
        TASK_TRIGGER obj = new TASK_TRIGGER();
        obj.cbTriggerSize = (ushort)Marshal.SizeOf(obj);
        return obj;
    }
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct SYSTEMTIME
    {
    [MarshalAs(UnmanagedType.U2)] short Year;
    [MarshalAs(UnmanagedType.U2)] short Month;
    [MarshalAs(UnmanagedType.U2)] short DayOfWeek;
    [MarshalAs(UnmanagedType.U2)] short Day;
    [MarshalAs(UnmanagedType.U2)] short Hour;
    [MarshalAs(UnmanagedType.U2)] short Minute;
    [MarshalAs(UnmanagedType.U2)] short Second;
    [MarshalAs(UnmanagedType.U2)] short Milliseconds;
    }

VB Definition:

<ComImport> _
<Guid("TODO")> _
'TODO: Insert <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ if this doesn't derive from IDispatch
Interface ITaskTrigger
   TODO
End Interface

User-Defined Types:

None.

Notes:

None.

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions