Search code examples
c++windowsapplication-shutdown

Is there a C++ function to turn off the computer?


Is there a C++ function to turn off the computer? And since I doubt there is one (in the standard library, at least), what's the windows function that I can call from C++?

Basically, what is the code to turn off a windows xp computer in c++?


Solution

  • On windows you can use the ExitWindows function described here:

    http://msdn.microsoft.com/en-us/library/aa376868(VS.85).aspx

    and here's a link to example code that does this:

    http://msdn.microsoft.com/en-us/library/aa376871(VS.85).aspx