Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force "it's now safe to turn off your computer" screen in Windows XP when shutting down?

Tags:

c++

I'm looking for a way to force Windows XP Pro SP3 to display the 'It's now safe to turn off your computer' screen when doing a shutdown.

The reason behind is that I want my UPS to turn off/on the power at some point and the PC should startup automatically again after the power cycle. In the BIOS this can be configured so that the PC powers on automatically if it sees power is being restored, but only if the PC was running before the power went away initially.

It seems it was possible to force this in Windows XP < SP1 by calling ExitWindowsEx with the EWX_SHUTDOWN uFlags parameter

See here for details

So why was this removed in SP1 and higher?

Any other ways to force this?

like image 819
Alex Avatar asked Dec 03 '13 13:12

Alex


People also ask

How can I automatically turn off the display when I shutdown my computer?

How to Make the Screen Turn Off Automatically in Windows 10. To control how fast your displays turn off, head to Start > Settings > System > Power & sleep and customize the times under the Screen header.

How do I stop Windows XP from automatically shutting down?

Windows XPRight-Click on "My Computer", and click "Properties" from the context menu that appears. Click on the "Advanced" tab. Click on "Settings" under "Startup and Recovery" (see screenshot). Uncheck the box labeled "Automatic Restart".

How do I shut down my computer screen?

Press the Windows logo key + X on your keyboard, and then select Shut down or sign out > Hibernate.

Is now safe to turn off computer?

Many computer users were trained never to turn their PCs off by pressing the power button on their desktop PC's case. This used to cause problems in the previous millennium, but it's now perfectly safe to shut down with the power button.


1 Answers

After two days of searching, I finally solved it, well actually a colleague of mine :-) !

Read this article for the details: https://web.archive.org/web/20140209015215/http://support.microsoft.com/kb/819760

Essentially it comes down to running:

reg add HKLM\Software\Policies\Microsoft\Windows NT /v DontPowerOffAfterShutdown /t REG_DWORD /d 1 /f

And then calling ExitWindowsEx with option EWX_SHUTDOWN from my application.

like image 133
Alex Avatar answered Nov 06 '22 16:11

Alex