How to automatically Logout or Even Turn off the machine?

  • Thread starter Thread starter Q. John Chen
  • Start date Start date
Q

Q. John Chen

How to automatically Logout or Even Turn off the machine?


I am NOT creating worm. Just to restrict my kids' computer time.
 
Hi!
Use P/Invoke to wrap LockWorkstation() for lock or ExitWindowsEx for
shutdown. To shutdown the computer, you could use WMI.
Hope that helps.
Best regards, Adrian.
 
Q. John Chen said:
How to automatically Logout or Even Turn off the machine?


I am NOT creating worm. Just to restrict my kids' computer time.

What would prevent them to reboot/logon after your "automatic"
logoff/shutdown?

Willy.
 
LockWorkStation() doesn't help. They have their own account and
password.

ExitWindowsEx is great for Logout (with EWX_FORCE)

WMI is also great for shutdown the machine.

SO, I made a simple program with TOP_MOST windows. Only two buttons,
Logoff and Shutdown (Added a third "5 More minutes" button to allow
save)

TO PREVENT FROM LOGIN BACK, I can remember the time they spent on that
day. Show the TOP_MOST window immediately when logging back in.
 
Back
Top