Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: NT
Expertise: Beginner
Dec 16, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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 Long
End Type

Private 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, _
End Sub
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date