Thread: How to SHUT DOWN?????

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    21

    How to SHUT DOWN?????

    Hi,
    Does anyone know how i can shut down my computer wiht a VC++ comand?
    thankx

  2. #2
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    ExitWindowsEx(EWX_SHUTDOWN, 0) should be adequate, but check MSDN for more parameter options.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    21
    thank you, it works for win9x but not for winXP... does anyone know why?

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    132
    When attempting to shutdown or restart a system with Windows XP, you must first call the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.

    Check out: AdjustTokenPrivileges()

    It will give you information on the function and how to use it in order to do this. Once you have access to shutdown the system, you can call ExitWindowsEx in order to shut the system down now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hardware interrupt to shut down
    By GanglyLamb in forum Tech Board
    Replies: 13
    Last Post: 06-11-2003, 01:23 PM
  2. Shut off DOS screen automatically to Windows
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 11-08-2001, 07:14 PM
  3. how often do you shut down?
    By WayTooHigh in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 10-12-2001, 02:18 PM
  4. Displaying the Shut Down Windows dialog
    By SMurf in forum Windows Programming
    Replies: 2
    Last Post: 09-14-2001, 05:52 PM