How to detect that the screen lid of a portable computer is shut?

ZoomZoom6

n00b
Joined
Sep 2, 2004
Messages
4
My boss asked me to make a little program that could detect that the computer lid of a portable computer is shut and lock the computer.

Windows XP allow us to put the computer in sleep mode or do nothing...

Is there a software out there that I didn't find that could do that or if any programmers out there can help me that would be nice.

Thank you very much!
 
There should be a security policy that will let you specify "On resume, password protect" - basically the "screensaver password" for XP. I'm not quite sure if that will work if the laptop goes to sleep, though.
 
If the machine is asleep it will prompt for a password. Options for what the machine does when the lid is closed are in control panel-power options-advanced.
 
Well, I don't want the computer to go to sleep. I want the computer to stay awake, but to ask me for a password without having to wait for the screensaver 1 minute delay.
 
Why not just lock the computer? ctrl-alt-del then spacebar, or [windows key]+L.
 
Because we don't want our users to do that. They will be in motion majority of the time and they have to lock the computer easily. Nothing is easier and faster than shut the computer lid.

Thank you for your answer :)
 
Then just let it go to sleep, it will take a few seconds on the wake up side, but it sounds like the best solution.

Thank you for your answer
Anytime.
 
ZoomZoom6 said:
Because we don't want our users to do that. They will be in motion majority of the time and they have to lock the computer easily. Nothing is easier and faster than shut the computer lid.

I'd say Windows+L is a pretty fast way, but if you want another method:

Create a shortcut on the user's desktop, called "Lock Workstation" and have the target be:
%windir%\System32\rundll32.exe user32.dll,LockWorkStation

Then they can double click the shortcut and it will lock their computer. More info here
 
the lid thing should be in control panel power options IIRC. Dell has a utility called quickset that is basically a wizard interface for those options that you may or may not find useful. I know for a fact that option is in there.
 
Thanks for the answer gang. I might ask Panasonic about a utility that may do that. I'll check for that avenue too.

Thank you again! You can lock this thread I guess. ;)
 
Back
Top