Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

API for NT Command Scheduler?

Question:
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?

Answer:
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, _
                     JobID:=p_lngJobID
                     
End Sub
DevX Pro
 
Comment and Contribute

 

 

 

 

 


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

 

 

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