Automatically lock screen on lid close in Windows 7

11,104

Solution 1

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.

Solution 2

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.

Share:
11,104

Related videos on Youtube

Dan
Author by

Dan

Updated on September 18, 2022

Comments

  • Dan
    Dan almost 2 years

    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?

  • Dan
    Dan over 10 years
    This is an interesting little hack that appears to mostly work, but if the computer is playing any audio it gets muted (not paused) when the lid is closed. Any idea how to fix that?
  • Joe
    Joe over 10 years
    Not too sure if this will pause the music but you could try right clicking on the sound icon, click on Playback Devices. There should be a tab that says "Communications" on the very right. Change the option to "Do Nothing". This will either stop the music completely or continue playing.
  • Dan
    Dan over 10 years
    That doesn't seem to have changed a thing.
  • Joe
    Joe over 10 years
    I'm not 100% sure then. The thing is, with changing the above registry key, this still keeps some settings from the Windows sleep mode so it'll be hard to change all. I'll try and have a play around if I can do this. Does the PC lock fine though?
  • Dan
    Dan over 10 years
    Yeah, the audio issue is the only thing I've noticed. I'll go ahead and accept your answer since it does technically answer the question as I asked it, but I'd really appreciate a solution to the audio thing if you can come up with anything.
  • Martheen
    Martheen over 10 years
    Away Mode seems to specifically turn off all video and audio since its use case is for leaving Media Centers for recording without bugging user with screen or sounds blogs.msdn.com/b/david_fleischman/archive/2005/10/21/… If you really need to keep the sound, perhaps there's no other option than using those 'sketchy' apps. Or changing your habit to Win-L first before closing the lid.
  • Montag451
    Montag451 about 9 years
    Can the same be applied to Windows 8?
  • Joe
    Joe about 9 years
    @Montag451 - Possibly; I haven't tested this on Windows 8 and unfortunately don't have a Windows machine to test. Backup your registry and give it a go!