|
Home > Tools > Code Samples > Windows Logoff/Shutdown
|
|
|
Windows Logoff/Shutdown
|
|
Rating: 4.83 out of 5 by 6 users
|
|
Submitted: 08/21/02
|
|
|
|
Brent Bishop
()
|
|
|
Download This Tool:
|
Logoff.zip
|
Disclaimer
|
|
|
This is the source code (and compiled executable) for a demo application written in VC++/MFC that demonstrates how to programmatically logoff or shutdown a computer. The source code accompanies a matching tutorial.
With no command line arguments a logoff dialog appears in which you can select "Logoff", "Restart", "Poweroff" or "Shutdown" from a drop down list and click the "OK" button to execute it.
It also accepts the following command line arguments so the actions can be performed from the command line or from a short cut, without the dialog box appearing.
Logoff.exe /LOGOFF
Logoff.exe /RESTART
Logoff.exe /POWEROFF
Logoff.exe /SHUTDOWN
|
This application could easily be extended to run in the background and respond to hot keys, to execute a batch file, or to run a backup program before logging off.
|
|
|