[comp.windows.ms] How can I automaticaly exit Windows?

jrobi@ccwf.cc.utexas.edu (James Barton) (06/04/91)

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

phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) (06/05/91)

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?

If there is an internal call (I don't have my book here at the moment)
that allows you to cause Windows to close down, then it should be possible
to make a program that simply does this.

For example if you want to have windows close down after 30 minutes of no
input, your program would have to hook into all the keyboard and mouse
events, and reset a timer back to 30 minutes when any event occurs.  When
the timer reaches 0, the program does its thing.

I should be able to try things like this in just a few weeks.
-- 
 /***************************************************************************\
/ Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu   |  Guns don't aim guns at  \
\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks  |  people; CRIMINALS do!!  /
 \***************************************************************************/

bobsc@microsoft.UUCP (Bob SCHMIDT) (06/07/91)

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