What next, a DOS version?? [Free tool and source code to temporarily prevent a computer from entering sleep mode – 32-bit and 64-bit versions now support Windows XP!]


This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments (11)
  1. Gert says:

    Thanks for a great application!

    I use it on my Windows 7 PC (the policy to force hibernate haven't been applied to XP PCs)

    I don't know if an option to use Away mode might also be useful? If it somehow uses less power than having a fully running PC it might, especially if the PC will enter away mode on a timer.

    Is there any advantages to using PowerSetRequest on Windows 7 above SetThreadExecutionState?

    Does ES_SYSTEM_REQUIRED disable any other parts of the power management? (Disks for example) (And if not, is there a way to disable it (I know ES_DISPLAY_REQUIRED works for the display) if an application requires low latency disk access for some reason? (I can see that something like a database server might want to wake up disks when receiving a new connection, since they are likely to be needed by a subsequent query))

  2. Delay says:

    Gert,

    I'm glad you like it, thanks! 🙂

    Away mode is an interesting idea – I've added it to my TODO list to think about for next time.

    PowerSetRequest looks like it doesn't do much more than SetThreadExecutionState except for allowing you to provide a localizable string in the call to PowerCreateRequest. And because the MSDN docs say it's only available on Windows 7 and later, I'm not sure I'm going to jump on it so soon after delivering Windows XP support… 🙂

    I don't think that ES_SYSTEM_REQUIRED disables other aspects of power management (for example, I'm pretty sure I've come back to my computer and heard the disks spin up). But if you're running a server, you probably want to change the machine's true power settings instead of counting on Insomnia to keep it awake. That said, if you really want to use Insomnia, you could always write a little program or batch file to write a small file to the disk every N minutes if you want to be sure they keep spinning…

  3. Gert says:

    I was mostly wondering what the API is capable of, but the .NET guy is probably not the one to ask….

    A way to esure that network services are available while saving the maximum amount of power would really be useful (especially in scenarios like a home file server (or office PC running remote dektop) that should be available at all times but might be inactive for hours at a time… (with the inactivity somewhat unpredictable)) I can see something like that implemented with a low-power co-processor on a NIC handling the basic connections (and things like ARP) and waking up the necessary components for the task. (For a file/web server, that would be the CPU, RAM and disk, if the data is not cached in RAM) With some tuning for predictive behavior, it should be possible to have a PC with almost all the advantages of sleep mode and almost as responsive over the network as one that is on. (It also really annoys me if TCP sessions (for SSH mostly) gets disconnected if the PC sleeps (the SSH client should probably keep the PC awake, but it doesn't) – which is where a low-impact sleep mode would also be useful)

    (I don't intend to run Insomnia on a server, but thought that API support for waking up other parts of the system might be useful for running efficient servers)

    (The documentation here: http://www.microsoft.com/…/AvailabilityRequests.mspx mentions how to detect Power request support with the fallback recommended for older versions of Windows)

  4. Delay says:

    Gert,

    Lots of interesting ideas there – but as you note, I'm not an expert on Windows power management internals. 🙂 I skimmed over the document you link to just now and it mainly served to reaffirm my impression that the new Windows 7 APIs don't enable a lot of new functionality for a program that's already using SetThreadExecutionState successfully. I'll try to keep an eye on this, though, in case things change in the future.

    Thanks again for sharing your thoughts!

  5. Will says:

    I ran this on Windows 7 SP1, both the 64 bit native version and the .NET version.  Neither prevented my computer from sleeping!  To double check, I changed the sleep timeout to 1 minute, and sure enough after a minute the display shut of and music playback stopped.  Am I missing something?

  6. Will says:

    Figured it out…my speakers are in my monitor and shutting of the display turns them off.  The music was still playing.  Spoke too soon.

  7. Delay says:

    Will,

    Glad you got that sorted out – thanks for following up! 🙂

  8. MentalPROblem says:

    Thanks for the app!

    I'm looking forward for you to add a feature of preventing the computer from being locked. At my job we have a group policy that automatically locks computers after like 10 minutes for security reasons, and once my computer is locked I no longer get sound notifications from Outlook when I get a new e-mail.

  9. Bags says:

    I keep getting either a size mismatch or invalid zip file message when I try to download. Is this just me or is there a problem?  

    Cheers

  10. Delay says:

    Bags,

    I just did a fresh download using CURL and verified it using UNZIP – the file I link to is okay. What you might try is to clear your browser cache and/or downloading the file to a different location using a different tool/browser – maybe something in the middle got a little confused?

    Good luck!

  11. Asif Bacchus says:

    I know this is a pretty old post but I just stumbled on your app and it works great!  Makes it easy for me to download large files now without worrying about the computer going to sleep.  Just wanted to say a huge thank you!

Comments are closed.