-
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
-
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.
-
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.