Shuting Down Win XP

This is a discussion on Shuting Down Win XP within the Windows Programming forums, part of the Platform Specific Boards category; Hey, Does anyone know how i would go about shuting down a PC running XP. I have tried the standard ...

  1. #1
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339

    Shuting Down Win XP

    Hey,

    Does anyone know how i would go about shuting down a PC running XP. I have tried the standard stuff that worked with win98 e.t.c

    Code:
    ExitWindowsEx(EWX_SHUTDOWN | EWX_POWEROFF, 0);
    also

    Code:
    ExitWindowsEx(EWX_SHUTDOWN, 0);

    None of the above work,

    Cheers
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    162
    I really have no idea if this will work or not or if you have tried it, but there is a function called ExitWindows(). My Windows reference says to make sure to set both the arguments to NULL.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    22

    shutting down windows xp

    Checking through the MSDN documentation on

    http://msdn.microsoft.com/library/de...tdown_3ago.asp

    wouldn't do you a bit of harm, but to start you off here's some exerpt from the site:

    Code:
    Use the ExitWindowsEx() function:
    prototype BOOL ExitWindowsEx(UINT uFlags, DWORD reason);
    
    uFlags can be:
    	EWX_POWEROFF
    		->	Shuts down the system and turns off the power.
    			Calling proc must have the SE_SHUTDOWN_NAME privilege.
    			in Windows NT/2000/XP
    	EWX_REBOOT
    		->	shuts down the system and restarts.
    			Calling proc must have the SE_SHUTDOWN_NAME privilege.
    			in Windows NT/2000/XP
    dwReason parameter:
    
    Windows XP: [in] Specifies the reason for initiating the shutdown. For more information, see System Shutdown Reason Codes.
    I would expect the dwReason parameter to be important in windows xp, check the codes on the following location:

    http://msdn.microsoft.com/library/de...tdown_2roz.asp

    Also pay particular attention to the privileges the calling process must have i.e SE_SHUTDOWN_NAME so you should read about the LocalSystem account, it has this privilege, so basically call CreateService and specify this account anyhow its all here:

    http://msdn.microsoft.com/library/de...vices_9bhw.asp

    Good luck, I hope that helps you.
    -------------------------
    Gerald.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 05-07-2009, 11:31 AM
  2. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  3. help with this
    By tyrantil in forum C Programming
    Replies: 18
    Last Post: 01-30-2005, 03:53 PM
  4. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM
  5. Dual Booting Win XP & Win 98
    By netboy in forum Tech Board
    Replies: 2
    Last Post: 08-18-2003, 02:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21