-
On Windows NT4, this seems to make it reboot rather than shut off. Can anyone get NT4 to power off rather than prompt for turnoff?
Code:
Private Enum SHUTDOWNFLAG
EWX_LOGOFF = 0
EWX_SHUTDOWN = 1
EWX_REBOOT = 2
EWX_FORCE = 4
EWX_POWEROFF = 8
End Enum
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As SHUTDOWNFLAG, ByVal dwReserved As Long) As Long
Private Sub cmdPoweroff_Click()
Dim retval As Long
retval = ExitWindowsEx(EWX_POWEROFF, 0)
Unload Me
End Sub
Thanks,
-
Try this:
Code:
Private Sub ExitWindows()
Dim rc As Long
rc = ExitWindowsEx(EWX_SHUTDOWN, 0)
End Sub
-
That takes you to the "It is now safe to shut off your computer" box where the user has to physically flip off the power switch, which I'm trying to avoid. It will be for NT 4.0 SP6a Workstations. MSDN says the EWX_POWEROFF is valid for NT, so I want to try to get it to work.
-
I don't think this works on NT, but you can combine these :
Code:
Dim Retval as Long
Retval = ExitWindowsEx(EWX_FORCE Or EWX_SHUTDOWN, 0)