Windows 7 can turn go to sleep when I close my lid, or after a period of inactivity. Fine.

I don't want it to go to sleep immediately after closing the lid; I want it to wait 5 minutes and then go to sleep.

Can this be done?

  • this stackoverflow.com/questions/3355606/… was about the needed API for creating such program. Still trying to decipher what it means. I suppose I can make a tiny C# apps to deal with it – Martheen Cahya Paulo Aug 8 '11 at 4:45
  • Why do you want to do this? – soandos Aug 8 '11 at 4:49
  • 2
    @soandos I close up my laptop around 5pm all the time, only to have the phone ring as I'm still packing it up with some final thing someone wants to check. – Joel Coehoorn Aug 8 '11 at 5:25

This capability isn't built into windows 7, and I'm not aware of software that will do this (thought that certainly doesn't mean no such software exists). If you have any programming ability (and your profile indicates you're no slouch here), this stackoverflow question will get you started building your own:


In a nutshell: set the default action in Windows 7 to not do anything, but have your program running as a service and handle the WM_POWERBROADCAST message. When you spot one with the right data, set a timer for 5 minutes and put the machine to sleep when it goes off. Different data on that message or messages that indicate user activity (like WM_MOUSEMOVE or WM_KEYDOWN) might cancel the timer.


I'm looking for the same thing (Windows 8.1 now). Lenovo used to have a utility in its power management program that did this, but it's no longer there (mostly as Windows machines start back up a lot faster than they used to).

I'm currently thinking there might be a way to create a scheduled task which is triggered by an event, which then starts a timer, and so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.