Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Task Scheduler wrapper functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Task Scheduler wrapper functions

    the task scheduler allows you to perform automated tasks on a chosen computer.
    the task scheduler monitors whatever criteria you choose and executes the task
    when the criteria for executing the task have been met. for example, you can
    have the computer run scandisk at 7:00 p.m. every sunday.

    documentation:

    http://msdn.microsoft.com/library/default.asp?url=/library/en- us/taskschd/taskschd/task_scheduler_start_page.asp


    since these interfaces derive directly from iunknown, can only be used doing
    direct vtable calls.

    below are include files containing wrapper functions for the needed interfaces:
    iunknown, ipersistfile and all the task scheduler interfaces.

    examples
    http://www.powerbasic.com/support/pb...ad.php?t=24507
    http://www.powerbasic.com/support/pb...ad.php?t=24508
    http://www.powerbasic.com/support/pb...ad.php?t=24509

    note
    if you have any comments, please use this thread:
    http://www.powerbasic.com/support/pb...ad.php?t=21275

    ------------------




    [this message has been edited by josé roca (edited march 04, 2005).]
    Forum: http://www.jose.it-berater.org/smfforum/index.php

  • #2
    IUnknown interface wrapper functions
    Save as IUnknown.inc

    Code:
    ' ********************************************************************************************
    ' IUnknown
    ' IID_IUnknown = GUID$("{00000000-0000-0000-c000-000000000046}")
    ' *********************************************************************************************
    
    $IID_IUnknown = GUID$("{00000000-0000-0000-c000-000000000046}")
    
    ' ********************************************************************************************
    ' QueryInterface method
    ' ********************************************************************************************
    ' Returns a pointer to a specified interface on an object to which a client currently holds an
    ' interface pointer. You must release the returned interface, when no longer needed, with a call
    ' to the Release method.
    ' ********************************************************************************************
    FUNCTION IUnknown_QueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
        LOCAL HRESULT AS LONG
        CALL DWORD @@pthis[0] USING IUnknown_QueryInterface(pthis, riid, ppvObj) TO HRESULT
        FUNCTION = HRESULT
    END FUNCTION
    ' ********************************************************************************************
    
    ' ********************************************************************************************
    ' AddRef method
    ' ********************************************************************************************
    ' The AddRef method increments the reference count for an interface on an object. It should be
    ' called for every new copy of a pointer to an interface on a given object.
    ' ********************************************************************************************
    FUNCTION IUnknown_AddRef (BYVAL pthis AS DWORD PTR) AS DWORD
        LOCAL DWRESULT AS LONG
        CALL DWORD @@pthis[1] USING IUnknown_AddRef(pthis) TO DWRESULT
        FUNCTION = DWRESULT
    END FUNCTION
    ' ********************************************************************************************
    
    ' ********************************************************************************************
    ' Release method
    ' ********************************************************************************************
    ' Decrements the reference count for the calling interface on a object. If the reference count
    ' on the object falls to 0, the object is freed from memory.
    ' ********************************************************************************************
    FUNCTION IUnknown_Release (BYVAL pthis AS DWORD PTR) AS DWORD
        LOCAL DWRESULT AS DWORD
        CALL DWORD @@pthis[2] USING IUnknown_Release(pthis) TO DWRESULT
        FUNCTION = DWRESULT
    END FUNCTION
    ' ********************************************************************************************

    ------------------
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      IPersistFile interface wrapper functions
      Save as IpersistFile.inc

      Code:
      ' *********************************************************************************************
      ' IPersistFile.inc - Include file for COM
      ' IID:IpersistFile = GUID$("{0000010B-0000-0000-C000-000000000046}")
      ' *********************************************************************************************
      
      $IID_IPersistFile = GUID$("{0000010b-0000-0000-c000-000000000046}")
      
      ' ********************************************************************************************
      ' GetClassID method (inherited from IPersist)
      ' *********************************************************************************************
      ' Retrieves the class identifier (CLSID) of an object. The CLSID is a unique value that
      ' identifies the code that can manipulate the persistent data.
      ' ********************************************************************************************
      ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetClassID )(
      '     IPersistFile __RPC_FAR * This,
      '     /* [out] */ CLSID __RPC_FAR *pClassID);
      ' ********************************************************************************************
      FUNCTION IPersistFile_GetClassID (BYVAL pthis AS DWORD PTR, BYREF pClassID AS GUID) AS LONG
          LOCAL HRESULT AS LONG
          CALL DWORD @@pthis[3] USING IPersistFile_GetClassID(pthis, pClassID) TO HRESULT
          FUNCTION = HRESULT
      END FUNCTION
      ' ********************************************************************************************
      
      ' ********************************************************************************************
      ' IsDirty method
      ' *********************************************************************************************
      ' Checks the object for changes since it was last saved.
      ' ********************************************************************************************
      ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsDirty )(
      '     IPersistFile __RPC_FAR * This);
      ' ********************************************************************************************
      FUNCTION IPersistFile_IsDirty (BYVAL pthis AS DWORD PTR) AS LONG
          LOCAL HRESULT AS LONG
          CALL DWORD @@pthis[4] USING IPersistFile_IsDirty(pthis) TO HRESULT
          FUNCTION = HRESULT
      END FUNCTION
      ' ********************************************************************************************
      
      ' ********************************************************************************************
      ' Load method
      ' *********************************************************************************************
      ' Initializes an object from the stream where it was previously saved.
      ' ********************************************************************************************
      ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Load )(
      '     IPersistFile __RPC_FAR * This,
      '     /* [in] */ LPCOLESTR pszFileName,
      '     /* [in] */ DWORD dwMode);
      ' ********************************************************************************************
      DECLARE FUNCTION Proto_IPersistFile_Load (BYVAL pthis AS DWORD PTR, BYVAL pszFileName AS DWORD, BYVAL dwMode as DWORD) AS LONG
      ' ********************************************************************************************
      FUNCTION IPersistFile_Load (BYVAL pthis AS DWORD PTR, BYVAL strFileName AS STRING, BYVAL dwMode as DWORD) AS LONG
          LOCAL HRESULT AS LONG
          strFileName = UCODE$(strFileName)
          CALL DWORD @@pthis[5] USING Proto_IPersistFile_Load(pthis, STRPTR(strFileName), dwMode) TO HRESULT
          FUNCTION = HRESULT
      END FUNCTION
      ' ********************************************************************************************
      
      ' ********************************************************************************************
      ' Save method
      ' *********************************************************************************************
      ' Saves an object to the specified stream.
      ' ********************************************************************************************
      ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )(
      '     IPersistFile __RPC_FAR * This,
      '     /* [unique][in] */ LPCOLESTR pszFileName,
      '     /* [in] */ BOOL fRemember);
      ' ********************************************************************************************
      DECLARE FUNCTION Proto_IPersistFile_Save (BYVAL pthis AS DWORD PTR, BYVAL pszFileName AS DWORD, BYVAL fRemember AS INTEGER) AS LONG
      ' ********************************************************************************************
      FUNCTION IPersistFile_Save (BYVAL pthis AS DWORD PTR, BYVAL strFileName AS STRING, BYVAL fRemember AS INTEGER) AS LONG
          LOCAL HRESULT AS LONG
          IF strFileName = "" THEN
             CALL DWORD @@pthis[6] USING Proto_IPersistFile_Save(pthis, %NULL, fRemember) TO HRESULT
          ELSE
             strFileName = UCODE$(strFileName)
             CALL DWORD @@pthis[6] USING Proto_IPersistFile_Save(pthis, STRPTR(strFileName), fRemember) TO HRESULT
          END IF
          FUNCTION = HRESULT
      END FUNCTION
      ' ********************************************************************************************
      
      ' ********************************************************************************************
      ' SaveCompleted method
      ' *********************************************************************************************
      ' Notifies the object that it can write to its file. It does this by notifying the object that
      ' it can revert from NoScribble mode (in which it must not write to its file), to Normal mode
      ' (in which it can). The component enters NoScribble mode when it receives an
      ' IPersistFile_Save call.
      ' ********************************************************************************************
      ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SaveCompleted )(
      '     IPersistFile __RPC_FAR * This,
      '     /* [unique][in] */ LPCOLESTR pszFileName);
      ' ********************************************************************************************
      DECLARE FUNCTION Proto_IPersistFile_SaveCompleted (BYVAL pthis AS DWORD PTR, BYVAL pszFileName AS DWORD) AS LONG
      ' ********************************************************************************************
      FUNCTION IPersistFile_SaveCompleted (BYVAL pthis AS DWORD PTR, BYVAL strFileName AS STRING) AS LONG
          LOCAL HRESULT AS LONG
          strFileName = UCODE$(strFileName)
          CALL DWORD @@pthis[7] USING Proto_IPersistFile_SaveCompleted(pthis, STRPTR(strFileName)) TO HRESULT
          FUNCTION = HRESULT
      END FUNCTION
      ' ********************************************************************************************
      
      ' ********************************************************************************************
      ' GetCurFile method
      ' *********************************************************************************************
      ' Retrieves either the absolute path to the object's current working file or, if there is no
      ' current working file, the object's default filename prompt.
      ' ********************************************************************************************
      ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCurFile )(
      '     IPersistFile __RPC_FAR * This,
      '     /* [out] */ LPOLESTR __RPC_FAR *ppszFileName);
      ' ********************************************************************************************
      FUNCTION IPersistFile_GetCurFile (BYVAL pthis AS DWORD PTR, BYREF strFileName AS STRING) AS LONG
          LOCAL HRESULT AS LONG
          CALL DWORD @@pthis[8] USING IPersistFile_GetCurFile(pthis, strFileName) TO HRESULT
          FUNCTION = HRESULT
      END FUNCTION
      ' ********************************************************************************************

      ------------------
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        Task Scheduler wrapper functions - Part I
        Save as TB_MSTSK.INC

        Code:
        ' ********************************************************************************************
        ' TB_MSTSK.INC - Task Scheduler wrapper functions
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' ClsIDs
        ' ********************************************************************************************
        $CLSID_CTask = GUID$("{148BD520-A2AB-11CE-B11F-00AA00530503}")
        $CLSID_CTaskScheduler = GUID$("{148BD52A-A2AB-11CE-B11F-00AA00530503}")
        
        ' ********************************************************************************************
        ' IIDs
        ' ********************************************************************************************
        $IID_ITaskTrigger = GUID$("{148BD52B-A2AB-11CE-B11F-00AA00530503}")
        $IID_IScheduledWorkItem = GUID$("{a6b952f0-a4b1-11d0-997d-00aa006887ec}")
        $IID_ITask = GUID$("{148BD524-A2AB-11CE-B11F-00AA00530503}")
        $IID_IEnumWorkItems = GUID$("{148BD528-A2AB-11CE-B11F-00AA00530503}")
        $IID_ITaskScheduler = GUID$("{148BD527-A2AB-11CE-B11F-00AA00530503}")
        $IID_IProvideTaskPage = GUID$("{4086658a-cbbb-11cf-b604-00c04fd8d565}")
        
        ' ********************************************************************************************
        ' Constants, enumerations and structures
        ' ********************************************************************************************
        %TASK_SUNDAY       = &H1
        %TASK_MONDAY       = &H2
        %TASK_TUESDAY      = &H4
        %TASK_WEDNESDAY    = &H8
        %TASK_THURSDAY     = &H10
        %TASK_FRIDAY       = &H20
        %TASK_SATURDAY     = &H40
        %TASK_FIRST_WEEK   = 1
        %TASK_SECOND_WEEK  = 2
        %TASK_THIRD_WEEK   = 3
        %TASK_FOURTH_WEEK  = 4
        %TASK_LAST_WEEK    = 5
        %TASK_JANUARY      = &H1
        %TASK_FEBRUARY     = &H2
        %TASK_MARCH        = &H4
        %TASK_APRIL        = &H8
        %TASK_MAY          = &H10
        %TASK_JUNE         = &H20
        %TASK_JULY         = &H40
        %TASK_AUGUST       = &H80
        %TASK_SEPTEMBER    = &H100
        %TASK_OCTOBER      = &H200
        %TASK_NOVEMBER     = &H400
        %TASK_DECEMBER     = &H800
        
        %TASK_FLAG_INTERACTIVE                  = &H1
        %TASK_FLAG_DELETE_WHEN_DONE             = &H2
        %TASK_FLAG_DISABLED                     = &H4
        %TASK_FLAG_START_ONLY_IF_IDLE           = &H10
        %TASK_FLAG_KILL_ON_IDLE_END             = &H20
        %TASK_FLAG_DONT_START_IF_ON_BATTERIES   = &H40
        %TASK_FLAG_KILL_IF_GOING_ON_BATTERIES   = &H80
        %TASK_FLAG_RUN_ONLY_IF_DOCKED           = &H100
        %TASK_FLAG_HIDDEN                       = &H200
        %TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET = &H400
        %TASK_FLAG_RESTART_ON_IDLE_RESUME       = &H800
        %TASK_FLAG_SYSTEM_REQUIRED              = &H1000
        %TASK_TRIGGER_FLAG_HAS_END_DATE         = &H1
        %TASK_TRIGGER_FLAG_KILL_AT_DURATION_END = &H2
        %TASK_TRIGGER_FLAG_DISABLED             = &H4
        
        %TASK_MAX_RUN_TIMES   = 1440
        
        ' 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
        
        TYPE tagDAILY
           DaysInterval AS WORD
        END TYPE
        
        TYPE tagWEEKLY
           WeeksInterval AS WORD
           rgfDaysOfTheWeek AS WORD
        END TYPE
        
        TYPE tagMONTHLYDATE
           rgfDays AS DWORD
           rgfMonths AS WORD
        END TYPE
        
        TYPE tagMONTHLYDOW
           wWhichWeek AS WORD
           rgfDaysOfTheWeek AS WORD
           rgfMonths AS WORD
           filler AS WORD     ' For DWORD alignment
        END TYPE
        
        UNION TRIGGER_TYPE_UNION
           Daily AS tagDAILY
           Weekly AS tagWEEKLY
           MonthlyDate AS tagMONTHLYDATE
           MonthlyDOW AS tagMONTHLYDOW
        END UNION
        
        TYPE TASK_TRIGGER
           cbTriggerSize AS WORD
           Reserved1 AS WORD
           wBeginYear AS WORD
           wBeginMonth AS WORD
           wBeginDay AS WORD
           wEndYear AS WORD
           wEndMonth AS WORD
           wEndDay AS WORD
           wStartHour AS WORD
           wStartMinute AS WORD
           MinutesDuration AS DWORD
           MinutesInterval AS DWORD
           rgFlags AS DWORD
           TriggerType AS LONG
           uType AS TRIGGER_TYPE_UNION
           Reserved2 AS WORD
           wRandomMinutesInterval AS WORD
        END TYPE
        
        ' enum _TASKPAGE
        %TASKPAGE_TASK     = 0
        %TASKPAGE_SCHEDULE = 1
        %TASKPAGE_SETTINGS = 2
        
        ' ********************************************************************************************
        ' ITaskTrigger interface
        ' ********************************************************************************************
        ' The ITaskTrigger interface is used to access and set triggers for a task. Triggers specify
        ' task start times, repetition criteria, and other parameters that control when a task is run.
        ' ITaskTrigger is the primary interface of the task_trigger object. To create a trigger object,
        ' call CreateTrigger or GetTrigger.
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetTrigger method
        ' ********************************************************************************************
        ' The SetTrigger method sets the trigger criteria for a task trigger.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetTrigger )(
        '     ITaskTrigger __RPC_FAR * This,
        '     /* [in] */ const PTASK_TRIGGER pTrigger);
        ' ********************************************************************************************
        FUNCTION ITaskTrigger_SetTrigger (BYVAL pthis AS DWORD PTR, BYREF pTrigger AS TASK_TRIGGER) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[3] USING ITaskTrigger_SetTrigger(pthis, pTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTrigger method
        ' ********************************************************************************************
        ' The GetTrigger method retrieves the current task trigger.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTrigger )(
        '     ITaskTrigger __RPC_FAR * This,
        '     /* [out] */ PTASK_TRIGGER pTrigger);
        ' ********************************************************************************************
        FUNCTION ITaskTrigger_GetTrigger (BYVAL pthis AS DWORD PTR, BYREF pTrigger AS TASK_TRIGGER) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[4] USING ITaskTrigger_GetTrigger(pthis, pTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTriggerString method
        ' ********************************************************************************************
        ' The GetTriggerString method retrieves the current task trigger in the form of a string. This
        ' string appears in the Task Scheduler user interface in a form similar to "At 2PM every day, starting 5/11/97."
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTriggerString )(
        '     ITaskTrigger __RPC_FAR * This,
        '     /* [out] */ LPWSTR __RPC_FAR *ppwszTrigger);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_ITaskTrigger_GetTriggerString (BYVAL pthis AS DWORD PTR, BYREF ppwszTrigger AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION ITaskTrigger_GetTriggerString (BYVAL pthis AS DWORD PTR, BYREF strTrigger AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            LOCAL ppwszTrigger AS DWORD PTR
            LOCAL bstrLen AS LONG
            LOCAL buffer AS STRING
            CALL DWORD @@pthis[5] USING Proto_ITaskTrigger_GetTriggerString(pthis, ppwszTrigger) TO HRESULT
            strTrigger = ""
            IF ISTRUE ppwszTrigger THEN
               bstrlen = lstrlenW(BYVAL ppwszTrigger)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(ppwszTrigger, bstrlen * 2)
                  strTrigger = ACODE$(buffer)
               END IF
               CoTaskMemFree ppwszTrigger
            END IF
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' IScheduledWorkItem interface
        ' ********************************************************************************************
        ' The IScheduledWorkItem interface provides methods for managing specific work items.
        ' IScheduledWorkItem is the base interface for the ITask interface. All methods provided by
        ' IScheduledWorkItem are inherited by the ITask interface and are typically called through the
        ' ITask interface.
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' CreateTrigger method
        ' ********************************************************************************************
        ' The CreateTrigger method creates a trigger for the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CreateTrigger )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *piNewTrigger,
        '     /* [out] */ IScheduledWorkItemTrigger __RPC_FAR *__RPC_FAR *ppTrigger);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_CreateTrigger (BYVAL pthis AS DWORD PTR, BYREF piNewTrigger AS WORD, BYREF ppTrigger AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[3] USING IScheduledWorkItem_CreateTrigger(pthis, piNewTrigger, ppTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' DeleteTrigger method
        ' ********************************************************************************************
        ' The DeleteTrigger method deletes a trigger from a work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DeleteTrigger )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ WORD iTrigger);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_DeleteTrigger (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[4] USING IScheduledWorkItem_DeleteTrigger(pthis, iTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTriggerCount method
        ' ********************************************************************************************
        ' The GetTriggerCount method retrieves the number of triggers for the current work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTriggerCount )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *pwCount);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetTriggerCount (BYVAL pthis AS DWORD PTR, BYREF pwCount AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[5] USING IScheduledWorkItem_GetTriggerCount(pthis, pwCount) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTrigger method
        ' ********************************************************************************************
        ' The GetTrigger method retrieves a task trigger.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTrigger )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ WORD iTrigger,
        '     /* [out] */ IScheduledWorkItemTrigger __RPC_FAR *__RPC_FAR *ppTrigger);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetTrigger (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD, BYREF ppTrigger AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[6] USING IScheduledWorkItem_GetTrigger(pthis, iTrigger, ppTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTriggerString method
        ' ********************************************************************************************
        ' The GetTriggerString method retrieves a string that describes the work item trigger.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTriggerString )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ WORD iTrigger,
        '     /* [out] */ LPWSTR __RPC_FAR *ppwszTrigger);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_IScheduledWorkItem_GetTriggerString (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD, BYREF ppwszTrigger AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetTriggerString (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD, BYREF strTrigger AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            LOCAL ppwszTrigger AS DWORD PTR
            LOCAL bstrLen AS LONG
            LOCAL buffer AS STRING
            CALL DWORD @@pthis[7] USING Proto_IScheduledWorkItem_GetTriggerString(pthis, iTrigger, ppwszTrigger) TO HRESULT
            strTrigger = ""
            IF ISTRUE ppwszTrigger THEN
               bstrlen = lstrlenW(BYVAL ppwszTrigger)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(ppwszTrigger, bstrlen * 2)
                  strTrigger = ACODE$(buffer)
               END IF
               CoTaskMemFree ppwszTrigger
            END IF
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetRunTimes method
        ' ********************************************************************************************
        ' The GetRunTimes method retrieves the work item run times for a specified time period.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRunTimes )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ const LPSYSTEMTIME pstBegin,
        '     /* [in] */ const LPSYSTEMTIME pstEnd,
        '     /* [out][in] */ WORD __RPC_FAR *pCount,
        '     /* [out] */ LPSYSTEMTIME __RPC_FAR *rgstTaskTimes);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetRunTimes (BYVAL pthis AS DWORD PTR, BYREF pstBegin AS SYSTEMTIME, BYREF pstEnd AS SYSTEMTIME, BYREF pCount AS WORD, BYREF rgstTaskTimes AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[8] USING IScheduledWorkItem_GetRunTimes(pthis, pstBegin, pstEnd, pCount, rgstTaskTimes) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetNextRunTime method
        ' ********************************************************************************************
        ' The GetNextRunTime method retrieves the next time the work item will run.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNextRunTime )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out][in] */ SYSTEMTIME __RPC_FAR *pstNextRun);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetNextRunTime (BYVAL pthis AS DWORD PTR, BYREF pstNextRun AS SYSTEMTIME) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[9] USING IScheduledWorkItem_GetNextRunTime(pthis, pstNextRun) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetIdleWait method
        ' ********************************************************************************************
        ' The SetIdleWait method sets the minutes that the system must be idle before the work item can run.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIdleWait )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ WORD wIdleMinutes,
        '     /* [in] */ WORD wDeadlineMinutes);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetIdleWait (BYVAL pthis AS DWORD PTR, BYVAL wIdleMinutes AS WORD, BYVAL wDeadlineMinutes AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[10] USING IScheduledWorkItem_SetIdleWait(pthis, wIdleMinutes, wDeadlineMinutes) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetIdleWait method
        ' ********************************************************************************************
        ' The GetIdleWait method retrieves the idle wait time for the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIdleWait )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *pwIdleMinutes,
        '     /* [out] */ WORD __RPC_FAR *pwDeadlineMinutes);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetIdleWait (BYVAL pthis AS DWORD PTR, BYREF wIdleMinutes AS WORD, BYREF wDeadlineMinutes AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[11] USING IScheduledWorkItem_GetIdleWait(pthis, wIdleMinutes, wDeadlineMinutes) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' Run method
        ' ********************************************************************************************
        ' The Run method sends a request to the Task Scheduler service to run the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Run )(
        '     IScheduledWorkItem __RPC_FAR * This);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_Run (BYVAL pthis AS DWORD PTR) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[12] USING IScheduledWorkItem_Run(pthis) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' Terminate method
        ' ********************************************************************************************
        ' The Terminate method ends the execution of the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Terminate )(
        '     IScheduledWorkItem __RPC_FAR * This);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_Terminate (BYVAL pthis AS DWORD PTR) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[13] USING IScheduledWorkItem_Terminate(pthis) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' EditWorkItem method
        ' ********************************************************************************************
        ' The EditWorkItem method displays the Task, Schedule, and settings property pages for the
        ' work item, allowing a user set the properties on those pages.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EditWorkItem )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ HWND hParent,
        '     /* [in] */ DWORD dwReserved);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_EditWorkItem (BYVAL pthis AS DWORD PTR, BYVAL hParent AS DWORD, BYVAL dwReserved AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[14] USING IScheduledWorkItem_EditWorkItem(pthis, hParent, dwReserved) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetMostRecentRunTime method
        ' ********************************************************************************************
        ' The GetMostRecentRunTime method retrieves the most recent time the work item began running.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetMostRecentRunTime )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ SYSTEMTIME __RPC_FAR *pstLastRun);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetMostRecentRunTime (BYVAL pthis AS DWORD PTR, BYREF pstLastRun AS SYSTEMTIME) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[15] USING IScheduledWorkItem_GetMostRecentRunTime(pthis, pstLastRun) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetStatus method
        ' ********************************************************************************************
        ' The GetStatus method retrieves the status of the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStatus )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ HRESULT __RPC_FAR *phrStatus);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetStatus (BYVAL pthis AS DWORD PTR, BYREF phrStatus AS LONG) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[16] USING IScheduledWorkItem_GetStatus(pthis, phrStatus) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetExitCode method
        ' ********************************************************************************************
        ' The GetExitCode method retrieves the last exit code returned by the executable associated
        ' with the work item on its last run. The method also returns the exit code returned to Task
        ' Scheduler when it last attempted to run the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetExitCode )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ DWORD __RPC_FAR *pdwExitCode);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetExitCode (BYVAL pthis AS DWORD PTR, BYREF pdwExitCode AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[17] USING IScheduledWorkItem_GetExitCode(pthis, pdwExitCode) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetComment method
        ' ********************************************************************************************
        ' The SetComment method sets the comment for the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetComment )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ LPCWSTR pwszComment);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_IScheduledWorkItem_SetComment (BYVAL pthis AS DWORD PTR, BYVAL pwszComment AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetComment (BYVAL pthis AS DWORD PTR, BYVAL strComment AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            strComment = UCODE$(strComment)
            CALL DWORD @@pthis[18] USING Proto_IScheduledWorkItem_SetComment(pthis, STRPTR(strComment)) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetComment method
        ' ********************************************************************************************
        ' The GetComment method retrieves the comment for the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetComment )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ LPWSTR __RPC_FAR *ppwszComment);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_IScheduledWorkItem_GetComment (BYVAL pthis AS DWORD PTR, BYREF ppwszComment AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetComment (BYVAL pthis AS DWORD PTR, BYREF strComment AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            LOCAL ppwszComment AS DWORD PTR
            LOCAL bstrLen AS LONG
            LOCAL buffer AS STRING
            CALL DWORD @@pthis[19] USING Proto_IScheduledWorkItem_GetComment(pthis, ppwszComment) TO HRESULT
            strComment = ""
            IF ISTRUE ppwszComment THEN
               bstrlen = lstrlenW(BYVAL ppwszComment)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(ppwszComment, bstrlen * 2)
                  strComment = ACODE$(buffer)
               END IF
               CoTaskMemFree ppwszComment
            END IF
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetCreator method
        ' ********************************************************************************************
        ' The SetCreator method sets the name of the work item's creator.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCreator )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ LPCWSTR pwszCreator);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_IScheduledWorkItem_SetCreator (BYVAL pthis AS DWORD PTR, BYVAL pwszCreator AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetCreator (BYVAL pthis AS DWORD PTR, BYVAL strCreator AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            strCreator = UCODE$(strCreator)
            CALL DWORD @@pthis[20] USING Proto_IScheduledWorkItem_SetCreator(pthis, STRPTR(strCreator)) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetCreator method
        ' ********************************************************************************************
        ' The GetCreator method retrieves the name of the creator of the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCreator )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ LPWSTR __RPC_FAR *ppwszCreator);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_IScheduledWorkItem_GetCreator (BYVAL pthis AS DWORD PTR, BYREF ppwszCreator AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetCreator (BYVAL pthis AS DWORD PTR, BYREF strCreator AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            LOCAL ppwszCreator AS DWORD PTR
            LOCAL bstrLen AS LONG
            LOCAL buffer AS STRING
            CALL DWORD @@pthis[21] USING Proto_IScheduledWorkItem_GetCreator(pthis, ppwszCreator) TO HRESULT
            strCreator = ""
            IF ISTRUE ppwszCreator THEN
               bstrlen = lstrlenW(BYVAL ppwszCreator)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(ppwszCreator, bstrlen * 2)
                  strCreator = ACODE$(buffer)
               END IF
               CoTaskMemFree ppwszCreator
            END IF
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetWorkItemData method
        ' ********************************************************************************************
        ' The SetWorkItemData method stores application-defined data associated with the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWorkItemData )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ WORD cbData,
        '     /* [in] */ BYTE __RPC_FAR rgbData[  ]);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetWorkItemData (BYVAL pthis AS DWORD PTR, BYVAL cbData AS WORD, BYVAL rgbData AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[22] USING IScheduledWorkItem_SetWorkItemData(pthis, cbData, rgbData) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetWorkItemData method
        ' ********************************************************************************************
        ' The GetWorkItemData method retrieves application-defined data associated with the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWorkItemData )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *pcbData,
        '     /* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbData);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetWorkItemData (BYVAL pthis AS DWORD PTR, BYREF pcbData AS WORD, BYREF prgbData AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[23] USING IScheduledWorkItem_GetWorkItemData(pthis, pcbData, prgbData) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetErrorRetryCount method
        ' ********************************************************************************************
        ' The SetErrorRetryCount method sets the number of times Task Scheduler will try to run the
        ' work item again if an error occurs. Not currently implemented.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetErrorRetryCount )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ WORD wRetryCount);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetErrorRetryCount (BYVAL pthis AS DWORD PTR, BYVAL wRetryCount AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[24] USING IScheduledWorkItem_SetErrorRetryCount(pthis, wRetryCount) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetErrorRetryCount method
        ' ********************************************************************************************
        ' The GetErrorRetryCount method returns the number of times that the Task Scheduler will retry
        ' an operation when an error occurs. This method is not implemented.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorRetryCount )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *pwRetryCount);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetErrorRetryCount (BYVAL pthis AS DWORD PTR, BYREF pwRetryCount AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[25] USING IScheduledWorkItem_GetErrorRetryCount(pthis, pwRetryCount) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetErrorRetryInterval method
        ' ********************************************************************************************
        ' The SetErrorRetryInterval method sets the time interval, in minutes, between Task Scheduler's
        ' attempts to run a work item after an error occurs. Not currently implemented.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetErrorRetryInterval )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ WORD wRetryInterval);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetErrorRetryInterval (BYVAL pthis AS DWORD PTR, BYVAL wRetryInterval AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[26] USING IScheduledWorkItem_SetErrorRetryInterval(pthis, wRetryInterval) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetErrorRetryInterval method
        ' ********************************************************************************************
        ' The GetErrorRetryInterval method retrieves the time interval, in minutes, between Task
        ' Scheduler's attempts to run a work item if an error occurs. Not currently implemented.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorRetryInterval )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *pwRetryInterval);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetErrorRetryInterval (BYVAL pthis AS DWORD PTR, BYREF pwRetryInterval AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[27] USING IScheduledWorkItem_GetErrorRetryInterval(pthis, pwRetryInterval) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetFlags method
        ' ********************************************************************************************
        ' The SetFlags method sets the flags that modify the behavior of any type of work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFlags )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ DWORD dwFlags);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetFlags (BYVAL pthis AS DWORD PTR, BYVAL dwFlags AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[28] USING IScheduledWorkItem_SetFlags(pthis, dwFlags) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetFlags method
        ' ********************************************************************************************
        ' The GetFlags method returns the flags that modify the behavior of any type of work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ DWORD __RPC_FAR *pdwFlags);
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetFlags (BYVAL pthis AS DWORD PTR, BYREF pdwFlags AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[29] USING IScheduledWorkItem_GetFlags(pthis, pdwFlags) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetAccountInformation method
        ' ********************************************************************************************
        ' The SetAccountInformation method sets the account name and password used to run the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAccountInformation )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [in] */ LPCWSTR pwszAccountName,
        '     /* [in] */ LPCWSTR pwszPassword);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_IScheduledWorkItem_SetAccountInformation (BYVAL pthis AS DWORD PTR, BYVAL pwszAccountName AS DWORD, BYVAL pwszPassword AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_SetAccountInformation (BYVAL pthis AS DWORD PTR, BYVAL strAccountName AS STRING, BYVAL strPassword AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            strAccountName = UCODE$(strAccountName)
            IF strPassword = "" THEN
               CALL DWORD @@pthis[30] USING Proto_IScheduledWorkItem_SetAccountInformation(pthis, STRPTR(strAccountName), %NULL) TO HRESULT
            ELSE
               strPassword = UCODE$(strPassword)
               CALL DWORD @@pthis[30] USING Proto_IScheduledWorkItem_SetAccountInformation(pthis, STRPTR(strAccountName), STRPTR(strPassword)) TO HRESULT
            END IF
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetAccountInformation method
        ' The GetAccountInformation method retrieves the account name for the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAccountInformation )(
        '     IScheduledWorkItem __RPC_FAR * This,
        '     /* [out] */ LPWSTR __RPC_FAR *ppwszAccountName);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_IScheduledWorkItem_GetAccountInformation (BYVAL pthis AS DWORD PTR, BYREF ppwszAccountName AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION IScheduledWorkItem_GetAccountInformation (BYVAL pthis AS DWORD PTR, BYREF strAccountName AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            LOCAL ppwszAccountName AS DWORD PTR
            LOCAL bstrLen AS LONG
            LOCAL buffer AS STRING
            CALL DWORD @@pthis[31] USING Proto_IScheduledWorkItem_GetAccountInformation(pthis, ppwszAccountName) TO HRESULT
            strAccountName = ""
            IF ISTRUE ppwszAccountName THEN
               bstrlen = lstrlenW(BYVAL ppwszAccountName)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(ppwszAccountName, bstrlen * 2)
                  strAccountName = ACODE$(buffer)
               END IF
               CoTaskMemFree ppwszAccountName
            END IF
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' ITask interface
        ' ********************************************************************************************
        ' The ITask interface is used to run tasks and to set and retrieve task properties. It is
        ' derived from the IScheduledWorkItem interface and inherits all the methods of that interface.
        ' ITask is the primary interface of the task trigger object. To create a task object, call
        ' ITaskScheduler_Activate for existing tasks or ITaskScheduler_NewWorkItem for new tasks.
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' CreateTrigger method
        ' ********************************************************************************************
        ' The CreateTrigger method creates a trigger for the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CreateTrigger )(
        '     ITask __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *piNewTrigger,
        '     /* [out] */ ITaskTrigger __RPC_FAR *__RPC_FAR *ppTrigger);
        ' ********************************************************************************************
        FUNCTION ITask_CreateTrigger (BYVAL pthis AS DWORD PTR, BYREF piNewTrigger AS WORD, BYREF ppTrigger AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[3] USING ITask_CreateTrigger(pthis, piNewTrigger, ppTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' DeleteTrigger method
        ' ********************************************************************************************
        ' The DeleteTrigger method deletes a trigger from a work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DeleteTrigger )(
        '     ITask __RPC_FAR * This,
        '     /* [in] */ WORD iTrigger);
        ' ********************************************************************************************
        FUNCTION ITask_DeleteTrigger (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[4] USING ITask_DeleteTrigger(pthis, iTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTriggerCount method
        ' ********************************************************************************************
        ' The GetTriggerCount method retrieves the number of triggers for the current work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTriggerCount )(
        '     ITask __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *pwCount);
        ' ********************************************************************************************
        FUNCTION ITask_GetTriggerCount (BYVAL pthis AS DWORD PTR, BYREF pwCount AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[5] USING ITask_GetTriggerCount(pthis, pwCount) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTrigger method
        ' ********************************************************************************************
        ' The GetTrigger method retrieves a task trigger.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTrigger )(
        '     ITask __RPC_FAR * This,
        '     /* [in] */ WORD iTrigger,
        '     /* [out] */ ITaskTrigger __RPC_FAR *__RPC_FAR *ppTrigger);
        ' ********************************************************************************************
        FUNCTION ITask_GetTrigger (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD, BYREF ppTrigger AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[6] USING ITask_GetTrigger(pthis, iTrigger, ppTrigger) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetTriggerString method
        ' ********************************************************************************************
        ' The GetTriggerString method retrieves a string that describes the work item trigger.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTriggerString )(
        '     ITask __RPC_FAR * This,
        '     /* [in] */ WORD iTrigger,
        '     /* [out] */ LPWSTR __RPC_FAR *ppwszTrigger);
        ' ********************************************************************************************
        DECLARE FUNCTION Proto_ITask_GetTriggerString (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD, BYREF ppwszTrigger AS DWORD) AS LONG
        ' ********************************************************************************************
        FUNCTION ITask_GetTriggerString (BYVAL pthis AS DWORD PTR, BYVAL iTrigger AS WORD, BYREF strTrigger AS STRING) AS LONG
            LOCAL HRESULT AS LONG
            LOCAL ppwszTrigger AS DWORD PTR
            LOCAL bstrLen AS LONG
            LOCAL buffer AS STRING
            CALL DWORD @@pthis[7] USING Proto_ITask_GetTriggerString(pthis, iTrigger, ppwszTrigger) TO HRESULT
            strTrigger = ""
            IF ISTRUE ppwszTrigger THEN
               bstrlen = lstrlenW(BYVAL ppwszTrigger)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(ppwszTrigger, bstrlen * 2)
                  strTrigger = ACODE$(buffer)
               END IF
               CoTaskMemFree ppwszTrigger
            END IF
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetRunTimes method
        ' ********************************************************************************************
        ' The GetRunTimes method retrieves the work item run times for a specified time period.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRunTimes )(
        '     ITask __RPC_FAR * This,
        '     /* [in] */ const LPSYSTEMTIME pstBegin,
        '     /* [in] */ const LPSYSTEMTIME pstEnd,
        '     /* [out][in] */ WORD __RPC_FAR *pCount,
        '     /* [out] */ LPSYSTEMTIME __RPC_FAR *rgstTaskTimes);
        ' ********************************************************************************************
        FUNCTION ITask_GetRunTimes (BYVAL pthis AS DWORD PTR, BYREF pstBegin AS SYSTEMTIME, BYREF pstEnd AS SYSTEMTIME, BYREF pCount AS WORD, BYREF rgstTaskTimes AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[8] USING ITask_GetRunTimes(pthis, pstBegin, pstEnd, pCount, rgstTaskTimes) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetNextRunTime method
        ' ********************************************************************************************
        ' The GetNextRunTime method retrieves the next time the work item will run.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNextRunTime )(
        '     ITask __RPC_FAR * This,
        '     /* [out][in] */ SYSTEMTIME __RPC_FAR *pstNextRun);
        ' ********************************************************************************************
        FUNCTION ITask_GetNextRunTime (BYVAL pthis AS DWORD PTR, BYREF pstNextRun AS SYSTEMTIME) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[9] USING ITask_GetNextRunTime(pthis, pstNextRun) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' SetIdleWait method
        ' ********************************************************************************************
        ' The SetIdleWait method sets the minutes that the system must be idle before the work item can run.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIdleWait )(
        '     ITask __RPC_FAR * This,
        '     /* [in] */ WORD wIdleMinutes,
        '     /* [in] */ WORD wDeadlineMinutes);
        ' ********************************************************************************************
        FUNCTION ITask_SetIdleWait (BYVAL pthis AS DWORD PTR, BYVAL wIdleMinutes AS WORD, BYVAL wDeadlineMinutes AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[10] USING ITask_SetIdleWait(pthis, wIdleMinutes, wDeadlineMinutes) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetIdleWait method
        ' ********************************************************************************************
        ' The GetIdleWait method retrieves the idle wait time for the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIdleWait )(
        '     ITask __RPC_FAR * This,
        '     /* [out] */ WORD __RPC_FAR *pwIdleMinutes,
        '     /* [out] */ WORD __RPC_FAR *pwDeadlineMinutes);
        ' ********************************************************************************************
        FUNCTION ITask_GetIdleWait (BYVAL pthis AS DWORD PTR, BYREF wIdleMinutes AS WORD, BYREF wDeadlineMinutes AS WORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[11] USING ITask_GetIdleWait(pthis, wIdleMinutes, wDeadlineMinutes) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' Run method
        ' ********************************************************************************************
        ' The Run method sends a request to the Task Scheduler service to run the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Run )(
        '     ITask __RPC_FAR * This);
        ' ********************************************************************************************
        FUNCTION ITask_Run (BYVAL pthis AS DWORD PTR) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[12] USING ITask_Run(pthis) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' Terminate method
        ' ********************************************************************************************
        ' The Terminate method ends the execution of the work item.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Terminate )(
        '     ITask __RPC_FAR * This);
        ' ********************************************************************************************
        FUNCTION ITask_Terminate (BYVAL pthis AS DWORD PTR) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[13] USING ITask_Terminate(pthis) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' EditWorkItem method
        ' ********************************************************************************************
        ' The EditWorkItem method displays the Task, Schedule, and settings property pages for the
        ' work item, allowing a user set the properties on those pages.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EditWorkItem )(
        '     ITask __RPC_FAR * This,
        '     /* [in] */ HWND hParent,
        '     /* [in] */ DWORD dwReserved);
        ' ********************************************************************************************
        FUNCTION ITask_EditWorkItem (BYVAL pthis AS DWORD PTR, BYVAL hParent AS DWORD, BYVAL dwReserved AS DWORD) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[14] USING ITask_EditWorkItem(pthis, hParent, dwReserved) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        
        ' ********************************************************************************************
        ' GetMostRecentRunTime method
        ' ********************************************************************************************
        ' The GetMostRecentRunTime method retrieves the most recent time the work item began running.
        ' ********************************************************************************************
        ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetMostRecentRunTime )(
        '     ITask __RPC_FAR * This,
        '     /* [out] */ SYSTEMTIME __RPC_FAR *pstLastRun);
        ' ********************************************************************************************
        FUNCTION ITask_GetMostRecentRunTime (BYVAL pthis AS DWORD PTR, BYREF pstLastRun AS SYSTEMTIME) AS LONG
            LOCAL HRESULT AS LONG
            CALL DWORD @@pthis[15] USING ITask_GetMostRecentRunTime(pthis, pstLastRun) TO HRESULT
            FUNCTION = HRESULT
        END FUNCTION
        ' ********************************************************************************************
        ------------------




        [This message has been edited by José Roca (edited March 04, 2005).]
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Task Scheduler wrapper functions - Part II
          Paste them after the above ones

          Code:
          ' ********************************************************************************************
          ' GetStatus method
          ' ********************************************************************************************
          ' The GetStatus method retrieves the status of the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStatus )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ HRESULT __RPC_FAR *phrStatus);
          ' ********************************************************************************************
          FUNCTION ITask_GetStatus (BYVAL pthis AS DWORD PTR, BYREF phrStatus AS LONG) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[16] USING ITask_GetStatus(pthis, phrStatus) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetExitCode method
          ' ********************************************************************************************
          ' The GetExitCode method retrieves the last exit code returned by the executable associated
          ' with the work item on its last run. The method also returns the exit code returned to Task
          ' Scheduler when it last attempted to run the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetExitCode )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ DWORD __RPC_FAR *pdwExitCode);
          ' ********************************************************************************************
          FUNCTION ITask_GetExitCode (BYVAL pthis AS DWORD PTR, BYREF pdwExitCode AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[17] USING ITask_GetExitCode(pthis, pdwExitCode) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetComment method
          ' ********************************************************************************************
          ' The SetComment method sets the comment for the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetComment )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszComment);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_SetComment (BYVAL pthis AS DWORD PTR, BYVAL pwszComment AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_SetComment (BYVAL pthis AS DWORD PTR, BYVAL strComment AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strComment = UCODE$(strComment)
              CALL DWORD @@pthis[18] USING Proto_ITask_SetComment(pthis, STRPTR(strComment)) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetComment method
          ' The GetComment method retrieves the comment for the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetComment )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ LPWSTR __RPC_FAR *ppwszComment);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_GetComment (BYVAL pthis AS DWORD PTR, BYREF ppwszComment AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_GetComment (BYVAL pthis AS DWORD PTR, BYREF strComment AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              LOCAL ppwszComment AS DWORD PTR
              LOCAL bstrLen AS LONG
              LOCAL buffer AS STRING
              CALL DWORD @@pthis[19] USING Proto_ITask_GetComment(pthis, ppwszComment) TO HRESULT
              strComment = ""
              IF ISTRUE ppwszComment THEN
                 bstrlen = lstrlenW(BYVAL ppwszComment)
                 IF ISTRUE bstrlen THEN
                    buffer = PEEK$(ppwszComment, bstrlen * 2)
                    strComment = ACODE$(buffer)
                 END IF
                 CoTaskMemFree ppwszComment
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetCreator method
          ' ********************************************************************************************
          ' The SetCreator method sets the name of the work item's creator.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCreator )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszCreator);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_SetCreator (BYVAL pthis AS DWORD PTR, BYVAL pwszCreator AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_SetCreator (BYVAL pthis AS DWORD PTR, BYVAL strCreator AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strCreator = UCODE$(strCreator)
              CALL DWORD @@pthis[20] USING Proto_ITask_SetCreator(pthis, STRPTR(strCreator)) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetCreator method
          ' ********************************************************************************************
          ' The GetCreator method retrieves the name of the creator of the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCreator )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ LPWSTR __RPC_FAR *ppwszCreator);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_GetCreator (BYVAL pthis AS DWORD PTR, BYREF ppwszCreator AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_GetCreator (BYVAL pthis AS DWORD PTR, BYREF strCreator AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              LOCAL ppwszCreator AS DWORD PTR
              LOCAL bstrLen AS LONG
              LOCAL buffer AS STRING
              CALL DWORD @@pthis[21] USING Proto_ITask_GetCreator(pthis, ppwszCreator) TO HRESULT
              strCreator = ""
              IF ISTRUE ppwszCreator THEN
                 bstrlen = lstrlenW(BYVAL ppwszCreator)
                 IF ISTRUE bstrlen THEN
                    buffer = PEEK$(ppwszCreator, bstrlen * 2)
                    strCreator = ACODE$(buffer)
                 END IF
                 CoTaskMemFree ppwszCreator
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetWorkItemData method
          ' ********************************************************************************************
          ' The SetWorkItemData method stores application-defined data associated with the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWorkItemData )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ WORD cbData,
          '     /* [in] */ BYTE __RPC_FAR rgbData[  ]);
          ' ********************************************************************************************
          FUNCTION ITask_SetWorkItemData (BYVAL pthis AS DWORD PTR, BYVAL cbData AS WORD, BYVAL rgbData AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[22] USING ITask_SetWorkItemData(pthis, cbData, rgbData) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetWorkItemData method
          ' ********************************************************************************************
          ' The GetWorkItemData method retrieves application-defined data associated with the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWorkItemData )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ WORD __RPC_FAR *pcbData,
          '     /* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbData);
          ' ********************************************************************************************
          FUNCTION ITask_GetWorkItemData (BYVAL pthis AS DWORD PTR, BYREF pcbData AS WORD, BYREF prgbData AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[23] USING ITask_GetWorkItemData(pthis, pcbData, prgbData) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetErrorRetryCount method
          ' ********************************************************************************************
          ' The SetErrorRetryCount method sets the number of times Task Scheduler will try to run the
          ' work item again if an error occurs. Not currently implemented.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetErrorRetryCount )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ WORD wRetryCount);
          ' ********************************************************************************************
          FUNCTION ITask_SetErrorRetryCount (BYVAL pthis AS DWORD PTR, BYVAL wRetryCount AS WORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[24] USING ITask_SetErrorRetryCount(pthis, wRetryCount) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetErrorRetryCount method
          ' ********************************************************************************************
          ' The GetErrorRetryCount method returns the number of times that the Task Scheduler will retry
          ' an operation when an error occurs. This method is not implemented.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorRetryCount )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ WORD __RPC_FAR *pwRetryCount);
          ' ********************************************************************************************
          FUNCTION ITask_GetErrorRetryCount (BYVAL pthis AS DWORD PTR, BYREF pwRetryCount AS WORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[25] USING ITask_GetErrorRetryCount(pthis, pwRetryCount) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetErrorRetryInterval method
          ' The SetErrorRetryInterval method sets the time interval, in minutes, between Task Scheduler's
          ' attempts to run a work item after an error occurs. Not currently implemented.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetErrorRetryInterval )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ WORD wRetryInterval);
          ' ********************************************************************************************
          FUNCTION ITask_SetErrorRetryInterval (BYVAL pthis AS DWORD PTR, BYVAL wRetryInterval AS WORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[26] USING ITask_SetErrorRetryInterval(pthis, wRetryInterval) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetErrorRetryInterval method
          ' ********************************************************************************************
          ' The GetErrorRetryInterval method retrieves the time interval, in minutes, between Task
          ' Scheduler's attempts to run a work item if an error occurs. Not currently implemented.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorRetryInterval )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ WORD __RPC_FAR *pwRetryInterval);
          ' ********************************************************************************************
          FUNCTION ITask_GetErrorRetryInterval (BYVAL pthis AS DWORD PTR, BYREF pwRetryInterval AS WORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[27] USING ITask_GetErrorRetryInterval(pthis, pwRetryInterval) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetFlags method
          ' ********************************************************************************************
          ' The SetFlags method sets the flags that modify the behavior of any type of work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFlags )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ DWORD dwFlags);
          ' ********************************************************************************************
          FUNCTION ITask_SetFlags (BYVAL pthis AS DWORD PTR, BYVAL dwFlags AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[28] USING ITask_SetFlags(pthis, dwFlags) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetFlags method
          ' ********************************************************************************************
          ' The GetFlags method returns the flags that modify the behavior of any type of work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ DWORD __RPC_FAR *pdwFlags);
          ' ********************************************************************************************
          FUNCTION ITask_GetFlags (BYVAL pthis AS DWORD PTR, BYREF pdwFlags AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[29] USING ITask_GetFlags(pthis, pdwFlags) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetAccountInformation method
          ' ********************************************************************************************
          ' The SetAccountInformation method sets the account name and password used to run the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAccountInformation )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszAccountName,
          '     /* [in] */ LPCWSTR pwszPassword);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_SetAccountInformation (BYVAL pthis AS DWORD PTR, BYVAL pwszAccountName AS DWORD, BYVAL pwszPassword AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_SetAccountInformation (BYVAL pthis AS DWORD PTR, BYVAL strAccountName AS STRING, BYVAL strPassword AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strAccountName = UCODE$(strAccountName)
              IF strPassword = "" THEN
                 CALL DWORD @@pthis[30] USING Proto_ITask_SetAccountInformation(pthis, STRPTR(strAccountName), %NULL) TO HRESULT
              ELSE
                 strPassword = UCODE$(strPassword)
                 CALL DWORD @@pthis[30] USING Proto_ITask_SetAccountInformation(pthis, STRPTR(strAccountName), STRPTR(strPassword)) TO HRESULT
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetAccountInformation method
          ' ********************************************************************************************
          ' The GetAccountInformation method retrieves the account name for the work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAccountInformation )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ LPWSTR __RPC_FAR *ppwszAccountName);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_GetAccountInformation (BYVAL pthis AS DWORD PTR, BYREF ppwszAccountName AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_GetAccountInformation (BYVAL pthis AS DWORD PTR, BYREF strAccountName AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              LOCAL ppwszAccountName AS DWORD PTR
              LOCAL bstrLen AS LONG
              LOCAL buffer AS STRING
              CALL DWORD @@pthis[31] USING Proto_ITask_GetAccountInformation(pthis, ppwszAccountName) TO HRESULT
              strAccountName = ""
              IF ISTRUE ppwszAccountName THEN
                 bstrlen = lstrlenW(BYVAL ppwszAccountName)
                 IF ISTRUE bstrlen THEN
                    buffer = PEEK$(ppwszAccountName, bstrlen * 2)
                    strAccountName = ACODE$(buffer)
                 END IF
                 CoTaskMemFree ppwszAccountName
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetApplicationName method
          ' ********************************************************************************************
          ' The SetApplicationName method assigns a specific application to the current task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetApplicationName )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszApplicationName);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_SetApplicationName (BYVAL pthis AS DWORD PTR, BYVAL pwszApplicationName AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_SetApplicationName (BYVAL pthis AS DWORD PTR, BYVAL strApplicationName AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strApplicationName = UCODE$(strApplicationName)
              CALL DWORD @@pthis[32] USING Proto_ITask_SetApplicationName(pthis, STRPTR(strApplicationName)) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetApplicationName method
          ' The GetApplicationName method retrieves the name of the application that the task is associated with.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetApplicationName )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ LPWSTR __RPC_FAR *ppwszApplicationName);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_GetApplicationName (BYVAL pthis AS DWORD PTR, BYREF ppwszApplicationName AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_GetApplicationName (BYVAL pthis AS DWORD PTR, BYREF strApplicationName AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              LOCAL ppwszApplicationName AS DWORD PTR
              LOCAL bstrLen AS LONG
              LOCAL buffer AS STRING
              CALL DWORD @@pthis[33] USING Proto_ITask_GetApplicationName(pthis, ppwszApplicationName) TO HRESULT
              strApplicationName = ""
              IF ISTRUE ppwszApplicationName THEN
                 bstrlen = lstrlenW(BYVAL ppwszApplicationName)
                 IF ISTRUE bstrlen THEN
                    buffer = PEEK$(ppwszApplicationName, bstrlen * 2)
                    strApplicationName = ACODE$(buffer)
                 END IF
                 CoTaskMemFree ppwszApplicationName
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetParameters method
          ' ********************************************************************************************
          ' The SetParameters method sets the command-line parameters for the task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetParameters )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszParameters);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_SetParameters (BYVAL pthis AS DWORD PTR, BYVAL pwszParameters AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_SetParameters (BYVAL pthis AS DWORD PTR, BYVAL strParameters AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strParameters = UCODE$(strParameters)
              CALL DWORD @@pthis[34] USING Proto_ITask_SetParameters(pthis, STRPTR(strParameters)) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetParameters method
          ' ********************************************************************************************
          ' The GetParameters method retrieves the task's command-line parameters.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetParameters )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ LPWSTR __RPC_FAR *ppwszParameters);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_GetParameters (BYVAL pthis AS DWORD PTR, BYREF ppwszParameters AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_GetParameters (BYVAL pthis AS DWORD PTR, BYREF strParameters AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              LOCAL ppwszParameters AS DWORD PTR
              LOCAL bstrLen AS LONG
              LOCAL buffer AS STRING
              CALL DWORD @@pthis[35] USING Proto_ITask_GetParameters(pthis, ppwszParameters) TO HRESULT
              strParameters = ""
              IF ISTRUE ppwszParameters THEN
                 bstrlen = lstrlenW(BYVAL ppwszParameters)
                 IF ISTRUE bstrlen THEN
                    buffer = PEEK$(ppwszParameters, bstrlen * 2)
                    strParameters = ACODE$(buffer)
                 END IF
                 CoTaskMemFree ppwszParameters
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetWorkingDirectory method
          ' The SetWorkingDirectory method sets the working directory for the task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWorkingDirectory )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszWorkingDirectory);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_SetWorkingDirectory (BYVAL pthis AS DWORD PTR, BYVAL pwszWorkingDirectory AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_SetWorkingDirectory (BYVAL pthis AS DWORD PTR, BYVAL strWorkingDirectory AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strWorkingDirectory = UCODE$(strWorkingDirectory)
              CALL DWORD @@pthis[36] USING Proto_ITask_SetWorkingDirectory(pthis, STRPTR(strWorkingDirectory)) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetWorkingDirectory method
          ' The GetWorkingDirectory method retrieves the task's working directory.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWorkingDirectory )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ LPWSTR __RPC_FAR *ppwszWorkingDirectory);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITask_GetWorkingDirectory (BYVAL pthis AS DWORD PTR, BYREF ppwszWorkingDirectory AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITask_GetWorkingDirectory (BYVAL pthis AS DWORD PTR, BYREF strWorkingDirectory AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              LOCAL ppwszWorkingDirectory AS DWORD PTR
              LOCAL bstrLen AS LONG
              LOCAL buffer AS STRING
              CALL DWORD @@pthis[37] USING Proto_ITask_GetWorkingDirectory(pthis, ppwszWorkingDirectory) TO HRESULT
              strWorkingDirectory = ""
              IF ISTRUE ppwszWorkingDirectory THEN
                 bstrlen = lstrlenW(BYVAL ppwszWorkingDirectory)
                 IF ISTRUE bstrlen THEN
                    buffer = PEEK$(ppwszWorkingDirectory, bstrlen * 2)
                    strWorkingDirectory = ACODE$(buffer)
                 END IF
                 CoTaskMemFree ppwszWorkingDirectory
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetPriority method
          ' ********************************************************************************************
          ' The SetPriority method sets the priority for the task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPriority )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ DWORD dwPriority);
          ' ********************************************************************************************
          FUNCTION ITask_SetPriority (BYVAL pthis AS DWORD PTR, BYVAL dwPriority AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[38] USING ITask_SetPriority(pthis, dwPriority) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetPriority method
          ' ********************************************************************************************
          ' The GetPriority method retrieves the priority for the task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPriority )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ DWORD __RPC_FAR *pdwPriority);
          ' ********************************************************************************************
          FUNCTION ITask_GetPriority (BYVAL pthis AS DWORD PTR, BYREF pdwPriority AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[39] USING ITask_GetPriority(pthis, pdwPriority) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetTaskFlags method
          ' ********************************************************************************************
          ' The SetTaskFlags method sets the flags that modify the behavior of a scheduled task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetTaskFlags )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ DWORD dwFlags);
          ' ********************************************************************************************
          FUNCTION ITask_SetTaskFlags (BYVAL pthis AS DWORD PTR, BYVAL dwFlags AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[40] USING ITask_SetTaskFlags(pthis, dwFlags) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetTaskFlags method
          ' ********************************************************************************************
          ' The GetTaskFlags method returns the flags that modify the behavior of a task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTaskFlags )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ DWORD __RPC_FAR *pdwFlags);
          ' ********************************************************************************************
          FUNCTION ITask_GetTaskFlags (BYVAL pthis AS DWORD PTR, BYREF pdwFlags AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[41] USING ITask_GetTaskFlags(pthis, pdwFlags) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetMaxRunTime method
          ' The SetMaxRunTime method sets the maximum time the task can run, in milliseconds, before terminating.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetMaxRunTime )(
          '     ITask __RPC_FAR * This,
          '     /* [in] */ DWORD dwMaxRunTimeMS);
          ' ********************************************************************************************
          FUNCTION ITask_SetMaxRunTime (BYVAL pthis AS DWORD PTR, BYVAL dwMaxRunTimeMS AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[42] USING ITask_SetMaxRunTime(pthis, dwMaxRunTimeMS) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetMaxRunTime method
          ' ********************************************************************************************
          ' The GetMaxRunTime method retrieves the maximum length of time, in milliseconds, the task can
          ' run before terminating.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetMaxRunTime )(
          '     ITask __RPC_FAR * This,
          '     /* [out] */ DWORD __RPC_FAR *pdwMaxRunTimeMS);
          ' ********************************************************************************************
          FUNCTION ITask_GetMaxRunTime (BYVAL pthis AS DWORD PTR, BYREF pdwMaxRunTimeMS AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[43] USING ITask_GetMaxRunTime(pthis, pdwMaxRunTimeMS) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          
          ' *********************************************************************************************
          ' IEnumWorkItems interface
          ' *********************************************************************************************
          ' The IEnumWorkItems interface provides methods for enumerating the tasks in the Scheduled
          ' Tasks folder.
          ' IEnumWorkItems is the primary interface of the enumeration object. To create the enumeration,
          ' call ITaskScheduler_Enum.
          ' *********************************************************************************************
          
          ' ********************************************************************************************
          ' Next method
          ' ********************************************************************************************
          ' The Next method retrieves the next specified number of tasks in the enumeration sequence. If
          ' there are fewer than the requested number of tasks left in the sequence, all the remaining
          ' elements are retrieved.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Next )(
          '     IEnumWorkItems __RPC_FAR * This,
          '     /* [in] */ ULONG celt,
          '     /* [out] */ LPWSTR __RPC_FAR *__RPC_FAR *rgpwszNames,
          '     /* [out] */ ULONG __RPC_FAR *pceltFetched);
          ' ********************************************************************************************
          FUNCTION IEnumWorkItems_Next (BYVAL pthis AS DWORD PTR, BYVAL celt AS DWORD, BYREF rgpwszNames AS DWORD, BYREF pceltFetched AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[3] USING IEnumWorkItems_Next(pthis, celt, rgpwszNames, pceltFetched) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' Skip method
          ' ********************************************************************************************
          ' The Skip method skips the next specified number of tasks in the enumeration sequence.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Skip )(
          '     IEnumWorkItems __RPC_FAR * This,
          '     /* [in] */ ULONG celt);
          ' ********************************************************************************************
          FUNCTION IEnumWorkItems_Skip (BYVAL pthis AS DWORD PTR, BYVAL celt AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[4] USING IEnumWorkItems_Skip(pthis, celt) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' Reset method
          ' The Reset method resets the enumeration sequence to the beginning.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )(
          '     IEnumWorkItems __RPC_FAR * This);
          ' ********************************************************************************************
          FUNCTION IEnumWorkItems_Reset (BYVAL pthis AS DWORD PTR) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[5] USING IEnumWorkItems_Reset(pthis) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' Clone method
          ' ********************************************************************************************
          ' The Clone method creates a new enumeration object that contains the same enumeration state
          ' as the current one. Because the new object points to the same place in the enumeration
          ' sequence, a client can use the Clone method to record a particular point in the enumeration
          ' sequence and return to that point later.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Clone )(
          '     IEnumWorkItems __RPC_FAR * This,
          '     /* [out] */ IEnumWorkItems __RPC_FAR *__RPC_FAR *ppEnumWorkItems);
          ' ********************************************************************************************
          FUNCTION IEnumWorkItems_Clone (BYVAL pthis AS DWORD PTR, BYREF ppenum AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[6] USING IEnumWorkItems_Clone(pthis, ppenum) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' ITaskScheduler interface
          ' ********************************************************************************************
          ' The ITaskScheduler interface provides methods for scheduling tasks.
          ' It is the primary interface of the task scheduler object. To create a task scheduler object,
          ' call CoCreateInstance.
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' SetTargetComputer method
          ' ********************************************************************************************
          ' The SetTargetComputer method selects the computer that the ITaskScheduler interface operates
          ' on, allowing remote task management and enumeration.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetTargetComputer )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszComputer);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITaskScheduler_SetTargetComputer (BYVAL pthis AS DWORD PTR, BYVAL pwszComputer AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_SetTargetComputer (BYVAL pthis AS DWORD PTR, BYVAL strComputer AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strComputer = UCODE$(strComputer)
              CALL DWORD @@pthis[3] USING Proto_ITaskScheduler_SetTargetComputer(pthis, STRPTR(strComputer)) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetTargetComputer method
          ' ********************************************************************************************
          ' The GetTargetComputer method returns the name of the computer on which ITaskScheduler is
          ' currently targeted.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTargetComputer )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [out] */ LPWSTR __RPC_FAR *ppwszComputer);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITaskScheduler_GetTargetComputer (BYVAL pthis AS DWORD PTR, BYREF ppwszComputer AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_GetTargetComputer (BYVAL pthis AS DWORD PTR, BYREF strComputer AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              LOCAL ppwszComputer AS DWORD PTR
              LOCAL bstrLen AS LONG
              LOCAL buffer AS STRING
              CALL DWORD @@pthis[4] USING Proto_ITaskScheduler_GetTargetComputer(pthis, ppwszComputer) TO HRESULT
              strComputer = ""
              IF ISTRUE ppwszComputer THEN
                 bstrlen = lstrlenW(BYVAL ppwszComputer)
                 IF ISTRUE bstrlen THEN
                    buffer = PEEK$(ppwszComputer, bstrlen * 2)
                    strComputer = ACODE$(buffer)
                 END IF
                 CoTaskMemFree ppwszComputer
              END IF
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' Enum method
          ' ********************************************************************************************
          ' The Enum method retrieves a pointer to an OLE enumerator object that enumerates the tasks in
          ' the current task folder.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Enum )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [out] */ IEnumWorkItems __RPC_FAR *__RPC_FAR *ppEnumWorkItems);
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_Enum (BYVAL pthis AS DWORD PTR, BYREF ppEnumWorkItems AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[5] USING ITaskScheduler_Enum(pthis, ppEnumWorkItems) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' Activate method
          ' ********************************************************************************************
          ' The Activate method returns an active interface for a specified work item.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Activate )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszName,
          '     /* [in] */ REFIID riid,
          '     /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITaskScheduler_Activate (BYVAL pthis AS DWORD PTR, BYVAL pwszName AS DWORD, BYREF riid AS GUID, BYREF ppUnk AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_Activate (BYVAL pthis AS DWORD PTR, BYVAL strName AS STRING, BYREF riid AS GUID, BYREF ppUnk AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              strName = UCODE$(strName)
              CALL DWORD @@pthis[6] USING Proto_ITaskScheduler_Activate(pthis, STRPTR(strName), riid, ppUnk) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' Delete method
          ' ********************************************************************************************
          ' The Delete method deletes a task.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszName);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITaskScheduler_Delete (BYVAL pthis AS DWORD PTR, BYVAL pwszName AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_Delete (BYVAL pthis AS DWORD PTR, BYVAL strName AS STRING) AS LONG
              LOCAL HRESULT AS LONG
              strName = UCODE$(strName)
              CALL DWORD @@pthis[7] USING Proto_ITaskScheduler_Delete(pthis, STRPTR(strName)) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' NewWorkItem method
          ' ********************************************************************************************
          ' The NewWorkItem method creates a new work item, allocating space for the work item and
          ' retrieving its address.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *NewWorkItem )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszTaskName,
          '     /* [in] */ REFCLSID rclsid,
          '     /* [in] */ REFIID riid,
          '     /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITaskScheduler_NewWorkItem (BYVAL pthis AS DWORD PTR, BYVAL pwszName AS DWORD, BYREF rclsid AS GUID, BYREF riid AS GUID, BYREF ppUnk AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_NewWorkItem (BYVAL pthis AS DWORD PTR, BYVAL strName AS STRING, BYREF rclsid AS GUID, BYREF riid AS GUID, BYREF ppUnk AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              strName = UCODE$(strName)
              CALL DWORD @@pthis[8] USING Proto_ITaskScheduler_NewWorkItem(pthis, STRPTR(strName), rclsid, riid, ppUnk) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' AddWorkItem method
          ' ********************************************************************************************
          ' The AddWorkItem method adds a task to the schedule of tasks.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddWorkItem )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszTaskName,
          '     /* [in] */ IScheduledWorkItem __RPC_FAR *pWorkItem);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITaskScheduler_AddWorkItem (BYVAL pthis AS DWORD PTR, BYVAL pwszTaskName AS DWORD, BYVAL pWorkItem AS DWORD) AS LONG
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_AddWorkItem (BYVAL pthis AS DWORD PTR, BYVAL strTaskName AS STRING, BYVAL pWorkItem AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              strTaskName = UCODE$(strTaskName)
              CALL DWORD @@pthis[9] USING Proto_ITaskScheduler_AddWorkItem(pthis, STRPTR(strTaskName), pWorkItem) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' IsOfType method
          ' ********************************************************************************************
          ' The IsOfType method checks the object's type to verify that it supports a particular interface.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsOfType )(
          '     ITaskScheduler __RPC_FAR * This,
          '     /* [in] */ LPCWSTR pwszName,
          '     /* [in] */ REFIID riid);
          ' ********************************************************************************************
          DECLARE FUNCTION Proto_ITaskScheduler_IsOfType (BYVAL pthis AS DWORD PTR, BYVAL pwszName AS DWORD, BYREF riid AS GUID) AS LONG
          ' ********************************************************************************************
          FUNCTION ITaskScheduler_IsOfType (BYVAL pthis AS DWORD PTR, BYVAL strName AS STRING, BYREF riid AS GUID) AS LONG
              LOCAL HRESULT AS LONG
              strName = UCODE$(strName)
              CALL DWORD @@pthis[10] USING Proto_ITaskScheduler_IsOfType(pthis, STRPTR(strName), riid) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************
          
          
          ' ********************************************************************************************
          ' IProvideTaskPage interface
          ' ********************************************************************************************
          ' The IProvideTaskPage interface provides access to the property sheet settings of a scheduled task.
          ' It is the primary interface of the task object. To create a task object, call
          ' ITaskScheduler_Activate for existing tasks or ITaskScheduler_NewWorkItem for new tasks.
          ' ********************************************************************************************
          
          ' ********************************************************************************************
          ' GetPage method
          ' ********************************************************************************************
          ' The GetPage method retrieves one or more property sheet pages associated with a task object.
          ' ********************************************************************************************
          ' HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPage )(
          '     IProvideTaskPage __RPC_FAR * This,
          '     /* [in] */ TASKPAGE tpType,
          '     /* [in] */ BOOL fPersistChanges,
          '     /* [out] */ HPROPSHEETPAGE __RPC_FAR *phPage);
          ' ********************************************************************************************
          FUNCTION IProvideTaskPage_GetPage (BYVAL pthis AS DWORD PTR, BYVAL tpType AS LONG, BYVAL fPersistChanges AS INTEGER, BYREF phPage AS DWORD) AS LONG
              LOCAL HRESULT AS LONG
              CALL DWORD @@pthis[3] USING IProvideTaskPage_GetPage(pthis, tpType, fPersistChanges, phPage) TO HRESULT
              FUNCTION = HRESULT
          END FUNCTION
          ' ********************************************************************************************

          ------------------
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment

          Working...
          X