views:

185

answers:

1

How can I in a Delphi application (7, trying to port it to 2010) force the system (XP or 7) to shut down?

+5  A: 

Look at Zarco Gajic's tip from About.com, "Shut down/reboot Windows 2000/XP/NT."

Serg
Fantastic, very ruthless, this will save my client a lot of electricity.
herman
@herman: If there is a chance that the system is running on remote desktop this may not be enough. You need to test, but I remember I had to add special code for an internal app to optionally use the `WTSShutdownSystem()` function, to actually shut down the PC without any request for confirmation.
mghie