dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Avoiding Standby/Hibernation mode

  1. #1
    Join Date
    Nov 2001
    Posts
    244

    Avoiding Standby/Hibernation mode

    Hi,

    I am trying to stop Windows from entering Standby/Hibernation mode in C++ VS2005.

    When the laptop's mouse or keyboard is not touched after a set amount of time, it enters Standby mode.

    The laptops dont use XP's Standby feature, it uses the manufacturers power management utility instead.

    Basically I need to generate a key press or mouse movement so the counter resets.

    The problem is the code I have tried doesnt work.

    So far I have tried:

    1) Using GetCursorPos and SetCursorPos to move the mouse 1 pixel every 20 seconds.

    2) Using PostMessage(WM_KEYDOWN, VK_SHIFT, NULL); and PostMessage(WM_KEYUP, VK_SHIFT, NULL);

    3) Using the GenerateKey() function found here http://www.codeguru.com/forum/showthread.php?t=377393



    These three techniques all do what they are expected to do (they move the mouse, and send key presses to notepad etc), but the Power Management utility ignores them, and the laptops still enter Standby Mode.

    I tried getting a Keyboard Press Tester to pick up the key presses, but it didnt detect them (I am using http://passmark.com/products/keytest.htm ).


    So somehow the Keyboard tester and the Power Management utility can detect the source of the key presses and ignores them. Perhaps they have put a Hook onto the keyboard/mouse driver or something.


    Is there any way to fool them otherwise?

  2. #2
    Join Date
    Sep 2007
    Location
    poland|wrocław
    Posts
    47

    Re: Avoiding Standby/Hibernation mode

    Im not sure, but read more about "ResetIdleTimer"

  3. #3
    Join Date
    Nov 2001
    Posts
    244

    Re: Avoiding Standby/Hibernation mode

    I found an alternative way to avoid standby

    SetThreadExecutionState(ES_SYSTEM_REQUIRED);
    SetThreadExecutionState(ES_DISPLAY_REQUIRED);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)