API for NT Command Scheduler?

API for NT Command Scheduler?

How can I program the NT Command Scheduler (AT command) using VB5? What are the API calls? Right now I’m just using Shell to run AT. Is this my only option?

This is a very simple example that should show you what you need to know to use the AT scheduling API:

Private Const JOB_RUN_PERIODICALLY       As Long = &H1&Private Const JOB_RUNS_TODAY             As Long = &H4&Private Const JOB_ADD_CURRENT_DATE       As Long = &H8&Private Const JOB_NONINTERACTIVE         As Long = &H10&Private Type AT_INFO   JobTime                             As Long   DaysOfMonth                         As Long   DaysOfWeek                          As Byte   Flags                               As Byte   Dummy                               As Integer   Command                             As LongEnd TypePrivate Declare Sub NetScheduleJobAdd _   Lib "netapi32.dll" _   (ByRef ServerName As Byte, _    ByVal Buffer As Any, _    ByVal JobID As Long)Public Sub Test(ByVal xi_Time_ms As Long)   Dim p_lngJobID                      As Long   Dim p_bytServerName()               As Byte   Dim p_typAT_Info                    As AT_INFO   Dim p_strCmd                        As String   Dim p_lngPtrToType                  As Long      p_typAT_Info.JobTime = xi_Time_ms ' Milliseconds past midnight   p_typAT_Info.DaysOfWeek = 0&   p_typAT_Info.DaysOfMonth = 0&   p_typAT_Info.Flags = 0&   p_strCmd = "CMD.EXE"   p_typAT_Info.Command = StrPtr(p_strCmd)      p_bytServerName = vbNullChar   p_lngPtrToType = VarPtr(p_typAT_Info)      NetScheduleJobAdd ServerName:=p_bytServerName(0), _                     Buffer:=p_lngPtrToType, _                     JobID:=p_lngJobID                     End Sub


Share the Post: