On 5/23/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Quoting Shidai Liu <[EMAIL PROTECTED] >:

> 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?
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to