PDA

View Full Version : C++ - turn off the computer


Lawn Gnome
02-21-2006, 05:12 AM
is there any code out there that can turn the computer off?

_Aerospace_Eng_
02-21-2006, 05:16 AM
Why? I see no real reason for this unless you are wanting to make an application that will be used maliciously.

felgall
02-21-2006, 08:48 PM
That functionality is built into the operating system. There will be a program in the operating system folder that does this.

intel17
02-22-2006, 03:06 PM
There are many programs that require your computer to be rebooted, and this person may need to write such a programe.

Is it possible to write a script in C++ to actually shutdown the computer or do you have to use a program in the operating system folder?

MetalStorm
02-22-2006, 11:36 PM
Try google, you can shut down Windows from the command line so the easiest way to get a C++ program to shutdown windows would be to execute that.

SpirtOfGrandeur
02-22-2006, 11:44 PM
Try google, you can shut down Windows from the command line so the easiest way to get a C++ program to shutdown windows would be to execute that.

Actually that is the most uncontrolled way of doing it. There are API's (http://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/shutdown/base/exitwindowsex.asp) for that reason!

oracleguy
02-23-2006, 06:20 AM
.. sort of, i mean the shutdown command on 2000/XP systems has a lot of command options to configure it. However then it does make your program much more platform specific.