Click here to Skip to main content
15,885,365 members
Articles / Programming Languages / Visual Basic

How to run Scheduled Task Wizard programmatically

Rate me:
Please Sign up or sign in to vote.
4.56/5 (10 votes)
5 Nov 2004CPOL2 min read 118.7K   2.4K   25  
Demonstration of how to run Scheduled Task Wizard programmatically, in VB and Borland C++ Builder.
Private Sub CommandButton1_Click()
Dim SA As Object
Dim vFolder, ItemFold, MyItemFolder, ShedulFold, SchedWizard, Verb As Object
Dim ShedulFoldX As Object

Set SA = CreateObject("Shell.Application")

ssfCONTROLS = 3
Set vFolder = SA.NameSpace(ssfCONTROLS)
Set ItemFold = vFolder.Items


Found = False
For Each MyItemFolder In ItemFold
    If MyItemFolder.Name = "Scheduled Tasks" Then
       Set ShedulFold = MyItemFolder.GetFolder
       Found = True
       Exit For
       End If
Next

If Found = False Then
End
End If


Set ShedulFoldX = ShedulFold.Items

For Each SchedWizard In ShedulFoldX
    If SchedWizard.Name = "Add Scheduled Task" Then
       Set Verbs = SchedWizard.Verbs
       SchedWizard.InvokeVerb (Verbs.Item(0))
       Exit For
       End If
Next

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Ukraine Ukraine
I am C++ Builder developer.
I am interesting in WMI, Shell, some deep
COM interface. Beside these I am Brainbench
Win32 API Master.
Now I very like Microsoft .NET and C#. I made some firsts OPOS drivers for Ukrainian fiscal printers.

Comments and Discussions