I am trying to write a program that will reboot a PC prior to running a backup program but I have been unsuccessful getting the PC to reboot. My code looks like this:
Public Const EWX_FORCE = 4
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1
Declare Function ExitWindowsEx Lib "user32" (ByValuFlags As Long, ByVal dwReserved As Long) As Long
Sub Restart()
Dim test As Long
test = ExitWindowsEx(EWX_FORCE, 0)
End Sub
Can anyone tell me why this doesn't work? Thanks!!
Public Const EWX_FORCE = 4
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1
Declare Function ExitWindowsEx Lib "user32" (ByValuFlags As Long, ByVal dwReserved As Long) As Long
Sub Restart()
Dim test As Long
test = ExitWindowsEx(EWX_FORCE, 0)
End Sub
Can anyone tell me why this doesn't work? Thanks!!