Skip to main content
GameDev.net gamedev.net
🔒 Locked

Computer Shutoff

Started by shortguy465 Apr 22, 2003 at 12:57 AM 2 replies 500+ views
Original Post
shortguy465
shortguy465
okay, i''ve looked everywhere and i just..can''t..find ANYTHING that covers turning your computer off. the only place i could find was the C++ Docs, and i still couldn''t get it working for the life of me!!! The closest thing i can get is BOOL ExitWindowsEx(EWX_SHUTOFF|EWX_FORCE); and BOOL ForceAppsClosed=TRUE; Can anyone tell me how to turn off the computer while an app is running? or just how to turn the computer off generally? (from a program of course)
Colin Jeanne
Colin Jeanne
ExitWindowsEx(EWX_SHUTDOWN, SHTDN_REASON_PLANNED); doesn''t work for you? What goes wrong?



Qui fut tout, et qui ne fut rien
Invader''s Realm
Toolmaker
Toolmaker
If you are running Windows 2000/XP/NT4, you need to acquire a security token for your program to shutdown.

I once did it from within VB, but never used C++ to shutdown windows. All I know, is that you need to set some security attributes in order to shutdown windows.

Toolmaker



-Earth is 98% full. Please delete anybody you can.
 
waynesroom
waynesroom
This is the code I use to shutdown.

ExitWindowsEx(EWX_POWEROFF | EWX_FORCE, 0)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.