Saturday, September 08, 2012

How to: make sure windows doesn't go to sleep/hibernate

I'm currently working on support tools for an embedded system. When loading new software or loggning information from the system it takes a long time. Got feedback from the users that the tools act strange when their computers went to sleep and the they activate  the computer again. No errors indicated in the tools but it the log files look strange.

The problem can be solved in two ways:

  1. Turn off the sleep/hibernate in windows.
    1. Control panel
    2. System
    3. Power options
    4. Plan
    5. Put computer to sleep never.

      This is an easy fix but it is impossible to ensure that the users do this, and when they run into this problem it's already to late.
  2. Make sure the application tells windows it is going to run a long process, and that the user needs to wait for it to complete.

    See Stack Overflow question. http://stackoverflow.com/questions/629240/prevent-windows-from-going-into-sleep-when-my-program-is-running

    On XP See: WM_POWERBROADCAST

    On Vista and Windows 7 See: SetThreadExecutionState

    This is the path I think is correct by telling the operating system what the application is doing it supports the application and user does not have to do anything to get the correct behavior when logging or uploading software to the system.

5 comments:

Anna Schafer said...

I think it could be more general if you get a football sports activity
BestSleepApneaTreat.com

Anonymous said...

Nice tips, it helped me so much, and that's why I wanna share with u this amazing service with Latest Software for Windows https://yepdownload.com/ that works really great.

Unknown said...

I think that downloading windows 7 professional iso download is best option

Jaxon Oakley said...

Nice one.

design said...

I feel that a debt of gratitude is in order for the valuabe data and experiences you have so given here. beginners solve rubiks cube