PDA

View Full Version : Locking and Unlocking Windows/Unix desktop



chrisjenx2001
15th October 2010, 21:16
Hello All.

As part of my project I would like my desktop application to be able to Lock and UnLock a PC.

Does anyone know if this is possible in Qt or C++?, I have been looking around and can't see it noted in the documentation or any forums for that matter.

What I mean:
If I clicked a button on my app it would be the same as hitting "Windows + L" (locking pc on windows)
Also remotely tell the program to UnLock the pc too.

I can figure that the code is going to have to be System Dependant, but if I could get it working primarily with Windows (XP/Vista/7) that would great.

Any help or direction would be greatly appreciated.

Thanks in advance.

Chris

squidge
15th October 2010, 23:47
You can emulate Windows+L in software by using LockWorkStation() (Win32API call) but the software must be running on the interactive desktop. Software running in the background will be refused by GINA (Graphical Identification and Authentication).

There is no function for unlocking, as that would cause a security concern.

If you wish to do both locking and unlocking in your own software, you will have to write your own - eg. write a keyboard hook, kill the explorer.exe process, etc, but ctrl-alt-del would still work to bring up task manager and you can't filter out that key sequence.