Click here to Skip to main content
15,885,366 members
Articles / Desktop Programming / MFC
Article

Lock WorkStation the MFC way

Rate me:
Please Sign up or sign in to vote.
2.56/5 (15 votes)
1 Aug 20042 min read 74.2K   3.2K   28   16
Allows the user to lock the workstation during lunch or meeting hours

Image 1

Introduction

This is a very small application that demonstrates the use of fullscreen dialog based applications. When the application is executed it goes and sits inside the systray with a key as a tray icon.

Using the application

  • To lock the screen, the user has to press a key combination of Ctrl+Alt+Minus sign on the numpad.
  • To unlock the screen user is asked to enter a password.
  • During lock mode, mouse cursor and caret are hidden as it happens in a normal booting screen, also Alt+Tab, Ctrl+Alt+Del keys are disabled.

But the user still can press Ctrl+Esc to activate the Start menu, In order to disable the Taskbar/StartButton, FindWindowEx API has been used and after taking the handle successfully the Taskbar is disabled, so that the user is not able to clcik on the TaskBar also. Currently the password has been hardcoded inside the application as "vkpassword". But developers can easily modify the application to store the password in registry or some encrypted file in the system. Use of Hotkeys have been implemented. To lock the screen user needs to press Ctrl+Alt+Minus sign on the numpad. A special thanks to Chris Maunder for his CSystemTray icon class used in the application.

How to get it installed?

  • Unzip the demo exe file
  • Double click on the exe file
  • The application goes and sits inside the SystemTray (thanx Chris!!)

Press Ctrl+Alt+Minus sign on Numpad. The system is locked now, to unlock enter password as "vkpassword" of course without the double quotes.

Notes

The application makes some changes in the registry, as to run during the computer start up, disabling the task manager using a registry hack. Hope you all will like the same and also don't forget to send me ur comments, suggestions to make it better. Thanks.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Technical Lead
India India
Hi I am Vikram, did my computers from NIIT with excellent score. Passion for VC++/MFC and developing my own utilities. Loves to do a lot of R&D on registry. Working in VC++/MFC from the last 6 years with SQL and MS-Access database. Currently working as a Project Lead with an MNC in Gurgaon.

Got my articles posted on Codeguru.com
1. Open Six Sites in one Browser
2. Customized icon in Message Box

Articles On CodeProject
1. Lock WorkStation the MFC Way
2. Gradient Dialog with a Colored ProgressBar
3. Move Start Button

Comments and Discussions

 
GeneralMy vote of 5 Pin
Member 671616028-Dec-10 17:50
Member 671616028-Dec-10 17:50 
GeneralCrappy Trojan - and here is why Pin
SB20031-Oct-09 22:07
SB20031-Oct-09 22:07 
GeneralCrappy Trojan Part II Pin
SB20031-Oct-09 22:31
SB20031-Oct-09 22:31 
GeneralRe: Crappy Trojan Part II Pin
Vikram Kashyap1-Oct-09 23:47
Vikram Kashyap1-Oct-09 23:47 
GeneralRe: Crappy Trojan Part II Pin
SB20032-Oct-09 6:24
SB20032-Oct-09 6:24 
GeneralLock the PC Pin
pHRO gHO8-May-08 8:05
pHRO gHO8-May-08 8:05 
GeneralNo Source Pin
koenjoeks20-Nov-07 0:34
koenjoeks20-Nov-07 0:34 
GeneralBypass startup. Pin
antsays2-Jul-06 22:32
antsays2-Jul-06 22:32 
GeneralUndo changes Pin
Myszka16-Dec-04 21:47
Myszka16-Dec-04 21:47 
Generalitz just for fun? try Ctrl + ESC... Pin
tony_w20003-Aug-04 18:46
tony_w20003-Aug-04 18:46 
GeneralI tell you gus it is a trash for you are unlikely to use a topmost window to lock ... Pin
Anonymous3-Aug-04 6:43
Anonymous3-Aug-04 6:43 
GeneralTo be more annoying :) Pin
Lars [Large] Werner3-Aug-04 1:50
professionalLars [Large] Werner3-Aug-04 1:50 
GeneralTrash Pin
goklll2-Aug-04 6:47
goklll2-Aug-04 6:47 
GeneralRe: Trash Pin
Anonymous2-Aug-04 22:30
Anonymous2-Aug-04 22:30 
QuestionWhere's the beef? Pin
NGS 54967226-Jul-04 5:47
NGS 54967226-Jul-04 5:47 
AnswerIt is in yr lunch sandwich Pin
WoodFire3226-Jul-04 9:35
WoodFire3226-Jul-04 9:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.