Condividi tramite


No rest for the weary [Free tool and source code to temporarily prevent a computer from entering sleep mode - now available for .NET, 32-bit, and 64-bit!]

**

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

  • Anonymous
    December 14, 2010
    Which shows directly that not every program has to be 64bit, it's only worth it if you really need to address more memory, otherwise it will just use more. Exactly the reason why even tools like Visual Studio are only 32bit. And the comparison is of course not perfectly :) comparing WPF with the Windows API...

  • Anonymous
    December 14, 2010
    I hate to bring this up but I was kind of surprised you didn't mention it...  You should do a WinForms version as well before you pin the consumption on the .NET Framework.  I wrote a simple WinForms app awhile back which is similar to yours in many ways.  It has one very simple window, wraps a small bit of Win32 API, and is meant to be run minimized all the time.  I checked its memory usage using your same procedure and got the following results, targeting .NET Framework 4.0 Client Profile and 32-bit only (x86): Commit: 17032KB   Private: 7232KB Sure, that's still much larger than your native version, but it's also much smaller than your WPF version.

  • Anonymous
    December 14, 2010
    Steve, I expect that one day 64-bit CPUs will no longer run 32-bit code - and then we'll be thankful we have native 64-bit applications (and .NET, of course). :) But for now you're totally right that some scenarios work perfectly well as 32-bit code!

  • Anonymous
    December 14, 2010
    Tom, Great point - some (possibly significant) portion of that extra memory is due to WPF and wouldn't be present with WinForms. Thanks for keeping me honest! :) That said, I'm not out to criticize the .NET Framework here - whatever UI it's running. I initially wrote Insomnia in WPF because it was (and is!) my favorite application development platform for the desktop - this time around I used native code because it's (approximately) as efficient as I can get without resorting to assembly. It's a comparison of extremes, to be sure. :)

  • Anonymous
    March 12, 2011
    Great idea, how has nobody thought of this?? But I need a version for ubuntu linux :-/ and based on how this app works I don't think running in WINE is going to be very productive!

  • Anonymous
    March 13, 2011
    Great if it would work. I get an error message of "The ordinal 380 could not be located in the Dynamic Link Library COMCTL32.dll. I using the 32-bit version. Any suggestions please?

  • Anonymous
    March 13, 2011
    Same issue as GIl. Running XP Pro SP3.

  • Anonymous
    March 14, 2011
    Same issue as Gil and Kevin

  • Anonymous
    March 14, 2011
    Same issue as GIl. Running XP Home 2002 SP3

  • Anonymous
    March 14, 2011
    Gil/Kevin/Brian/Jeff, The issue you're seeing is that Windows XP is old enough that it does not support some of the APIs that native Insomnia uses. This topic was discussed in the comments of the original blog post - here's a link to my explanation there: blogs.msdn.com/.../give-your-computer-insomnia-free-tool-and-source-code-to-temporarily-prevent-a-machine-from-going-to-sleep.aspx As I say, I know what needs to be done to back-port to XP, but it hasn't been clear how necessary doing so is given that the .NET version of Insomnia runs fine on XP (according to all reports). If any of you have thoughts on the matter or reasons that the .NET version wouldn't work for you, I'd love to hear them. Thanks!

  • Anonymous
    March 14, 2011
    You wouldn't happen to have made one to keep the monitor awake would you?  I leave my computer on 24/7 but, the monitor turns off after 15 min.  Which is fine unless I want to watch a video of some sort.  Then I either have to move the mouse every so often or change the settings.  Both of which gets annoying.  

  • Anonymous
    March 14, 2011
    mUrAt, No, I haven't implemented a code to prevent the screen saver from kicking in. However, it's a request I've heard before and it's on my TODO list to think about. :)

  • Anonymous
    March 14, 2011
    Thanks David for the explanation of the XP SP3 issue. It's just that I found out about your app from Gizmo's Freewarre site and they said to ignore the .NET version. See below. "...The download is 0.4 MB, and is a Zip file containing 3 versions of the program.  One is the .NET version, which you can safely ignore..." Guess hey should have caveated that with "unless you are still running XP!

  • Anonymous
    March 14, 2011
    Kevin, Thanks for the info - I've just left a comment there to help others out! :)

  • Anonymous
    March 14, 2011
    Thanks for addressing so quickly David. Did try the .NET version and works fine. Just trying to keep the mem usage to a minimum..

  • Anonymous
    March 14, 2011
    Thank you, I did find what I need from DontSleep.  But if you can come up with something better/smaller/easier, I'm sure it would be appreciated. www.softwareok.com

  • Anonymous
    March 14, 2011
    Doesn't work for me ! Windows XP Professional SP3 with .NET framework 4. As the other, the native version doesn't start and give an error The .Net version start but the computer continue to act as usual, aka after 15min the screensaver is activated  and the machine locked. A detail may be, the icon of the application is not there ! When the windows appear or in the tray, I have an empty white icon

  • Anonymous
    March 15, 2011
    ericc, Sorry about the trouble! If you're not seeing the tray icon, Insomnia probably isn't running - and if it's not running, it can't prevent the machine from going to sleep. :) I'm not sure why the .NET version wouldn't work for you on XP because I've heard from other people that it works just fine for them. But maybe it doesn't matter too much - I've prioritized the task of making native Insomnia run on Windows XP, so you should be able to use that instead. I hope to have something to share in about a week or so and will blog about it once I do. Thanks for your patience!

  • Anonymous
    March 16, 2011
    When I try to download from:  www.cesso.org/.../Insomnia.zip - by clicking the link you provide, I get a server not found message every time.  "Firefox can't find the server at www.cesso.org." Any suggestions?

  • Anonymous
    March 16, 2011
    dadwhiskers, Please try again - maybe the server was down for a bit when you tried earlier? I've verified that it's up right now and the download link still works, so your download should succeed. If it still fails, you might try using a different machine or a different browser; perhaps something has gone weird with the one you've been using. Please let me know if you still have trouble after trying that!

  • Anonymous
    March 18, 2011
    Excellent little utility and just what I was looking for. I am in a long distance relationship and sometimes we fall asleep togerther on cam (skype). It is a pain to keep the system alive other than the control panel. This solves all the problems. If a version comes with the ability to keep the screen alive as well (optional idealy) this would just be the icing on the cake. Thankyou very much!

  • Anonymous
    March 18, 2011
    John B, What a great story - thanks for sharing! :) FYI that XP is at the top of my TODO list, but screen saver prevention is right after it. Thanks for your support!

  • Anonymous
    March 23, 2011
    FYI that I've just updated the Insomnia download ZIP with 32-bit and 64-bit versions that should work on Windows XP: blogs.msdn.com/.../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.aspx Enjoy! :)

  • Anonymous
    January 03, 2012
    The comment has been removed

  • Anonymous
    January 04, 2012
    Robey, The SetThreadExecutionState API Insomnia calls also exposes a ES_DISPLAY_REQUIRED flag which should keep the display on - however, the documentation explicitly says "This function does not stop the screen saver from executing.", so I don't think it's quite what you want. I think there are other programs out there that fake moving the mouse pointer periodically to simulate user interaction and which would probably accomplish your goal of preventing the screen saver. That said, the automatic password protection of your machines may be part of your company's security policy, so it may not be worth trying to bypass it. :)

  • Anonymous
    January 04, 2012
    Many thanks for the response David. I quite appreciate what you say about bypassing security policies but I do think that 5 minutes is Draconian and unnecessary. I use the PC either at home or in the office with colleagues and in both cases there is nobody who would have a need or would gain a benefit from snooping - there's nothing especially confidential on it. Anyway, following your advice I found a program called Mouse Jiggler which seems to do the job admirably. Cheers

  • Anonymous
    March 12, 2012
    Brilliant little app. Just what I needed. And its crystal-clear simplicity is great.

  • Anonymous
    June 18, 2012
    The comment has been removed

  • Anonymous
    August 19, 2012
    Has this program been removed?  I keep finding dead links for the insomnia program

  • Anonymous
    August 19, 2012
    RichMD, No, sorry, it's still meant to be available. I switched my web hosting provider recently and the new on seems to have been down for about the past day. :( Please try again soon and I hope things will be working better - and if not, contact me via the contact form at the top right and I can email you the ZIP. Sorry for the trouble!

  • Anonymous
    September 25, 2012
    Great tool thanks. Group policy means my machine is liable to sleep at any time. Not any more :-)

  • Anonymous
    September 28, 2012
    The comment has been removed

  • Anonymous
    February 24, 2013
    My windows 8 home edition laptop falls asleep when the lid is closed (causing audio to cut out) regardless of if this is running or not.

  • Anonymous
    February 24, 2013
    WormyWyrm, Please see my comment here: blogs.msdn.com/.../give-your-computer-insomnia-free-tool-and-source-code-to-temporarily-prevent-a-machine-from-going-to-sleep.aspx

  • Anonymous
    May 29, 2013
    How do I install it?

  • Anonymous
    May 30, 2013
    M2920, Download the ZIP file above, unblock it, and extract the contents to a new folder by right-clicking it and clicking "extract". Then run whichever Insomnia application you choose (ex: .NET, 32-bit, 64-bit). For info about unblocking, please see: blogs.msdn.com/.../unblockingdownloadedfile.aspx

  • Anonymous
    June 20, 2013
    David, Is there a way to set this up to run minimized with windows task schedulere?

  • Anonymous
    June 20, 2013
    The comment has been removed

  • Anonymous
    June 20, 2013
    Thanks David!

  • Anonymous
    August 21, 2013
    Unfortunately, Insomnia doesn't work for me. My laptop goes to sleep 2 minutes after I close the lid. I have set every option I know to prevent it from sleeping, but nothing seems to work. Windows 7 SP1, all updates installed. Laptop is an Asus N53SV. Anyone any ideas? Thanks in advance!

  • Anonymous
    August 22, 2013
    Bart Zorn, On many laptops, the default behavior when the lid is closed is to go to sleep. Windows treats this as a user-initiated action, so Insomnia isn't able to prevent it. If you want to change that behavior, you can do so in Control Panel's Power Settings - there will be an option to configure what closing the lid does and you can set it to "nothing" instead of "go to sleep". Hope this helps!