[Tutor] [HELP]win32 shutdown, restart, logoff
Shidai Liu
shidai.liu at gmail.com
Mon May 23 02:43:46 CEST 2005
On 5/23/05, jfouhy at paradise.net.nz <jfouhy at paradise.net.nz> wrote:
>
> 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).
Thanks John.
I have the local machine's administration privilege. But my machine is
logged in a local network which disables shutdown, restart functions (Group
policy?). When I run the command as you point out, I got the following
messages
(5, 'InitiateSystemShutdown', 'Access is denied.')
I have noticed for some software which require restart, it can restart
properly. Does that mean software restart is possbile? If yes, any idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050523/f17e313a/attachment.htm
More information about the Tutor
mailing list