How do I tell Windows to shutdown?

Started by
2 comments, last by Oranda 21 years, 11 months ago
Is there an API funtion to make Windows shutdown? It''s for the big "Shutdown" button on my shell replacement. Thanks.
Advertisement
Take a look on MSDN for ExitWindowsEx. You'll likely want to use the flag EWX_SHUTDOWN (there are also flags for reboot, power off, log off, force application terminate)

[EDIT] Unclosed HREF was screwing up rest of page.

[edited by - michalson on May 2, 2002 8:27:00 AM]
Yeah, ExitWindowsEx() should do the trick.

The first argument can be either EWX_POWEROFF to shut down and power off or EWX_SHUTDOWN to shutdown to a state where it''s safe to switch the computer off. You can also use this routine to log users off and reboot the machine. Look up the documentation in MSDN...
Thankies! This place sure has grown since I was here last. Half-hour turn-around times for replies is sweet!

This topic is closed to new replies.

Advertisement