Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!microsoft!bobsc From: bobsc@microsoft.UUCP (Bob SCHMIDT) Newsgroups: comp.windows.ms Subject: Re: How can I automaticaly exit Windows? Message-ID: <72797@microsoft.UUCP> Date: 7 Jun 91 04:27:12 GMT References: <49975@ut-emx.uucp> Reply-To: bobsc@microsoft.UUCP (Bob SCHMIDT) Organization: Microsoft Corp., Redmond WA Lines: 20 In article <49975@ut-emx.uucp> jrobi@ccwf.cc.utexas.edu (James Barton) writes: %% I would like to be able to have Windows turn itself off gracefully at a %% specified time or following some specifiable event. Anybody know how to %% do this? %% %% JB Try 'ExitWindows', which is documented for Windows 3.0. What isn't documented (but will be in the next release) is that you can also have Windows exit, then restart (just like Windows setup). The first parameter to 'ExitWindows' is a mysterious "reserved code". Turns out that using 0x42 for that code causes Windows to restart. Set the code to 0x0 for Windows to exit back to DOS. Note that 'ExitWindows' asks each app if it wants to shut down; if any one says "no", the call fails. This will get you the "turn itself off gracefully" part; you have to do the rest (i.e., figure out what events trigger the exit).