Originally published on: Wed, 02 Dec 2009 03:11:19 +0000
Several years ago, a friend and I discussed the topic of a program that would, after a period of inactivity, issue the equivalent function of locking one's Windows session via CTRL-ALT-DEL followed by a click on the appropriate "lock" button. The screen-saver was supposed to fulfill this role, but the thought-process was that someone could disable their screen-saver.
I did a little investigation into the matter and could not find a way to lock the session via a program. Years later, a function was added to user32.dll that could be invoked to provide this functionality. The C program below attempts to find this function in User32 dynamically and then invokes it. If not found, an error message will be displayed.
lock.c
The source and sample executable file for lock can be downloaded in a single archive at: http://www.mailsend-online.com/wp/lock.zip
Unless otherwise noted, all code and text entries are Copyright ©2009 by James K. Lawless
Save to del.icio.us
Save to StumbleUpon
Digg it
Save to Reddit
Share on Facebook
Share on Twitter
More bookmarks
Subscribe!
Auto Save Clipboard Images Redux
Extending SpiderMonkey JavaScript on Windows
Rhino JavaScript to EXE with launch4j
Compiling Rhino JavaScript to Java
Directory Traversal in Rhino JavaScript
A Command-Line MP3 Player for Windows
Auto Save Images from the Clipboard
Java in a Windows EXE with launch4j
An Interview with Tom Zimmer: Forth System Developer
Setting Windows Console Text Colors in C
Checking Shift States with DEBUG
Command-Line Image Format Conversion
Book Review : Using Google App Engine
Speeding up JRuby with NailGun
MicroISV on a Shoestring
DadHacker
The Bottom Feeder
Writin' That Code!
The Recursive ISV
The Thomsen Blog
Prototypically Speaking
The Reinvigorated Programmer