[Tutor] [HELP]win32 shutdown, restart, logoff

jfouhy@paradise.net.nz jfouhy at paradise.net.nz
Mon May 23 02:09:26 CEST 2005


Quoting Shidai Liu <shidai.liu at gmail.com>:

> Any one know how to make a shutdown, restart, logoff call in windows os
> like 98, 2000 and xp?

Try this: win32api.InitiateSystemShutdown(None, 'Kaboom!', 2000, False, False)

Parameters:
 1. Computer to shutdown (None for lcoalhost)
 2. Message to display.
 3. Time in ms to display message (0 for no message).
 4. Kill programs (False to allow user a chance to save their work).
 5. Reboot or shutdown.

If you are doing win32 programming, I strongly recommend Mark Hammond's book!
(since that's where I got this information)

Note that I have not tested this (in particular, it is possible I have the
orientation of the two boolean parameters wrong).

-- 
John.


More information about the Tutor mailing list