- ' Dans votre Form, mettez :
- ' Un txtbox nommé : TxtNbSec
- ' Un bouton nommé : BtnReboot
-
- Option Explicit
- Private Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long
-
- Private Sub Apropos_Click()
- MsgBox ("Forcer le reboot d'une station NT/2000")
- End Sub
-
- Private Sub BtnReboot_Click()
- InitiateSystemShutdown "\\127.0.0.1", "Ce système va être rebooté suite à la demande de BSDCUBEReboot.", CLng(Me.TxtNbSec.Text), True, True
- ' Nom de la machine, Message qui va s'afficher, Délai (en seconde, j'ai déjà mis 28800 sec pour programmer l'arrêt et ça marche aussi), Forcer la fermeture des application ouvertes, Redemarrer (false = arrêt)
- End Sub
-
- Private Sub quitter_Click()
- End
- End Sub
-
- Private Sub TxtNbSec_KeyPress(KeyAscii As Integer)
- If KeyAscii < 48 Or KeyAscii > 57 Then
- MsgBox ("Seulement de chiffres")
- KeyAscii = 0
- End If
- End Sub
' Dans votre Form, mettez :
' Un txtbox nommé : TxtNbSec
' Un bouton nommé : BtnReboot
Option Explicit
Private Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long
Private Sub Apropos_Click()
MsgBox ("Forcer le reboot d'une station NT/2000")
End Sub
Private Sub BtnReboot_Click()
InitiateSystemShutdown "\\127.0.0.1", "Ce système va être rebooté suite à la demande de BSDCUBEReboot.", CLng(Me.TxtNbSec.Text), True, True
' Nom de la machine, Message qui va s'afficher, Délai (en seconde, j'ai déjà mis 28800 sec pour programmer l'arrêt et ça marche aussi), Forcer la fermeture des application ouvertes, Redemarrer (false = arrêt)
End Sub
Private Sub quitter_Click()
End
End Sub
Private Sub TxtNbSec_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
MsgBox ("Seulement de chiffres")
KeyAscii = 0
End If
End Sub