Originally published on: Wed, 02 Dec 2009 03:11:19 +0000
Please note! If you're having difficulties compiling the C source code presented below, please see my post: Compiling C from the Command Line with Pelles C
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
Views expressed in this blog are those of the author and do not necessary reflect those of the author's employer. Views expressed in the comments are those of the responding individual.

Save to StumbleUpon
Digg it
Save to Reddit
Share on Facebook
Share on Twitter
More bookmarks
Click **here**
A JavaScript REPL for Android Devices
A Review of Kevin Mitnick's Book Ghost in the Wires
Play MP3 Files with Python on Windows
Checking Shift States with DEBUG
A TCP Command Line Interface in Rhino JavaScript
Stacking Images with PerlMagick
BPL: Batch Programming Language Interpreter
A Simple Media Control Interface Script Processor
Yet Another Enhanced Echo Command
Why Some Web Sites will go Dark on Jan 18th
Book Review : Paull Allen - Idea Man
A 90's Experiment in Online Systems - The U.S. West CommunityLink Service