Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
this… 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
@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.

share|improve this answer
And btw, thanks for your work on C#. – Joel Coehoorn Aug 8 '11 at 5:24

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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