res = NetScheduleJobAdd(vbNullString, atInfo, NewJobID)
If res <> 0 Then
MsgBox res
Else
MsgBox NewJobID
End If
res = GlobalFree(atInfo.Command)
End Sub
4. Run the sample.
5. Click the Command Button.
RESULT: You should get a message box with the Job ID assigned to the scheduled
task or the error number if an error occured. In this case, NOTEPAD.EXE
should be scheduled to run the next time 11:30 AM occurs.
-- Axel GUERRIER Microsoft France -------------------- Merci de bien vouloir répondre à ce message dans le newsgroup où il a été posté. Je le consulte régulièrement.
"Hervé" wrote in message news:0ae401c38f04$fc6deed0$ Bonjour,
J'aimerais programmer en vb des taches planifiées. Y a t- il une api qui le permet ? Où pourrais je trouver de l'aide ?
Merci pour vos réponses. Hervé
Bonjour Hervé,
regarde du côté de NetScheduleJobAdd...
voici un morceau de code (non testé):
1. Create a new Standard EXE project. Form1 is created by default.
2. Add a command button to Form1.
3. Paste the following code into the code window of Form1:
Option Explicit
Private Declare Function NetScheduleJobAdd Lib "netapi32.dll" ( _
ByVal servername As String, _
bufPtr As Any, _
JobID As Long) _
As Long
Private Declare Function NetApiBufferFree Lib "netapi32.dll" ( _
bufPtr As Any) _
As Long
Private Declare Sub CopyToMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
ByVal hpvDest As Long, _
ByVal hpvSource As String, _
ByVal cbCopy As Long)
Private Declare Function GlobalAlloc Lib "kernel32" ( _
ByVal Flags As Long, _
ByVal numBytes As Long) _
As Long
Private Declare Function GlobalFree Lib "kernel32" ( _
hMem) _
As Long
Private Const GMEM_ZEROINIT = &H40
Private Const GMEM_FIXED = &H0
Private Const GPTR = (GMEM_FIXED Or GMEM_ZEROINIT)
res = NetScheduleJobAdd(vbNullString, atInfo, NewJobID)
If res <> 0 Then
MsgBox res
Else
MsgBox NewJobID
End If
res = GlobalFree(atInfo.Command)
End Sub
4. Run the sample.
5. Click the Command Button.
RESULT: You should get a message box with the Job ID assigned to the
scheduled
task or the error number if an error occured. In this case, NOTEPAD.EXE
should be scheduled to run the next time 11:30 AM occurs.
--
Axel GUERRIER
Microsoft France
--------------------
Merci de bien vouloir répondre à ce message dans le newsgroup où il a été
posté. Je le consulte régulièrement.
"Hervé" <lagant@dga.jouy.inra.fr> wrote in message
news:0ae401c38f04$fc6deed0$a301280a@phx.gbl...
Bonjour,
J'aimerais programmer en vb des taches planifiées. Y a t-
il une api qui le permet ?
Où pourrais je trouver de l'aide ?
res = NetScheduleJobAdd(vbNullString, atInfo, NewJobID)
If res <> 0 Then
MsgBox res
Else
MsgBox NewJobID
End If
res = GlobalFree(atInfo.Command)
End Sub
4. Run the sample.
5. Click the Command Button.
RESULT: You should get a message box with the Job ID assigned to the scheduled
task or the error number if an error occured. In this case, NOTEPAD.EXE
should be scheduled to run the next time 11:30 AM occurs.
-- Axel GUERRIER Microsoft France -------------------- Merci de bien vouloir répondre à ce message dans le newsgroup où il a été posté. Je le consulte régulièrement.
"Hervé" wrote in message news:0ae401c38f04$fc6deed0$ Bonjour,
J'aimerais programmer en vb des taches planifiées. Y a t- il une api qui le permet ? Où pourrais je trouver de l'aide ?
Merci pour vos réponses. Hervé
Christophe QUEVAL
Avec la commande Windows "AT" ?
"Hervé" a écrit dans le message de news:0ae401c38f04$fc6deed0$ Bonjour,
J'aimerais programmer en vb des taches planifiées. Y a t- il une api qui le permet ? Où pourrais je trouver de l'aide ?
Merci pour vos réponses. Hervé
Avec la commande Windows "AT" ?
"Hervé" <lagant@dga.jouy.inra.fr> a écrit dans le message de
news:0ae401c38f04$fc6deed0$a301280a@phx.gbl...
Bonjour,
J'aimerais programmer en vb des taches planifiées. Y a t-
il une api qui le permet ?
Où pourrais je trouver de l'aide ?