Automatically lock screen on lid close in Windows 7

I'm a longtime Linux user, and I just recently got a laptop that runs Windows 7. I recently stepped away from my workstation for a few minutes, and returned to find, to my horror, someone else sitting at my laptop watching a video on YouTube. It seems like they hadn't done anything else, but the possibility that they could have quickly browsed through my saved passwords or something still concerns me. I'm so used to all my Linux machines locking the instant I close the lid, I hadn't even considered the possibility that it wouldn't happen in Windows. As it turns out, I can't even find an option to make it happen.

I've seen a couple sketchy-looking programs I can run in the background that will supposedly achieve what I need. Is that really the only way to secure my machine? I don't want the computer to sleep or hibernate every time I close the lid. Is there something in the control that will help out that I just missed? If not, what program or other solution would you recommend?


I believe you can change some registry settings to have the PC lock when you shut the lid:

  1. Launch registry (start > regedit)
  2. Local the following: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Power
  3. Right Click > New > DWORD (32 bits)
  4. Rename it to AwayModeEnabled
  5. Select AwayModeEnabled > Right Click > Change value to 1 (hexadecimal)
  6. Go to Power Options and change the lid close action to Sleep.

This should have 'tricked' the OS into locking the PC when the lid is closed (rather than putting this to sleep).

Please backup your registry before making any changes just in case you change the wrong thing.


You might want to look at related question: How to Lock (not sleep) laptop on lid close?

I wrote a very lightweight application called LapLock that achieves the behavior you're looking for. Unfortunately there doesn't seem to be a clean way to do this without resorting to a third-party application.