Shutdown |
Option Explicit Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, _ ByVal dwReserved As Long) As Boolean Private Const EWX_SHUTDOWN = 1 Private Sub Form_Load() Dim success As Variant success = ExitWindowsEx(EWX_SHUTDOWN, 0) End Sub |
Reboot |
Option Explicit Private Const EWX_REBOOT As Long = 2 Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long Private Sub Form_Load() Dim lngResult As Long lngResult = ExitWindowsEx(EWX_REBOOT, 0&) End Sub |