Home  |  FAQ  |  About  |  Contact  |  View Source   
 
SEARCH:
 
BROWSE:
    My Hood
Edit My Info
View Events
Read Tutorials
Training Modules
View Presentations
Download Tools
Scan News
Get Jobs
Message Forums
School Forums
Member Directory
   
CONTRIBUTE:
    Sign me up!
Post an Event
Submit Tutorials
Upload Tools
Link News
Post Jobs
   
   
Home >  Tools >  Code Samples >  Windows Logoff/Shutdown
Add to MyHood
Windows Logoff/Shutdown
Stats
  Rating: 4.83 out of 5 by 6 users
  Submitted: 08/21/02
Brent Bishop ()

Download This Tool: 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.


Return to Browsing Tools

Email this Tool to a Friend

Rate this Content:  
low quality  1 2 3 4 5  high quality



Reader's Comments Post a Comment
 
Thanks for figuring out all of the cryptic documentation. I've used this tool and it's pretty simple to understand. Thanks for doing the hard work.
-- Beau Neal , August 27, 2002
 
The tutorial can be found here, in the General Coding section.
-- Brent Bishop , August 29, 2002
 
heh heh pretty cool stuff
-- John Woo , November 10, 2002
 
Copyright © 2001 DevHood® All Rights Reserved