|
-
Apr 10th, 2001, 12:23 PM
#1
Thread Starter
Black Cat
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,
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Apr 10th, 2001, 12:27 PM
#2
PowerPoster
Try this:
Code:
Private Sub ExitWindows()
Dim rc As Long
rc = ExitWindowsEx(EWX_SHUTDOWN, 0)
End Sub
-
Apr 10th, 2001, 01:23 PM
#3
Thread Starter
Black Cat
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.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Apr 10th, 2001, 02:17 PM
#4
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)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|