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.dev-archive.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?
[1447 byte] By [Anarchi] at [2007-11-20 11:34:44]
# 1 Re: Avoiding Standby/Hibernation mode
Im not sure, but read more about "ResetIdleTimer"
macabre13 at 2007-11-10 22:24:59 >
# 2 Re: Avoiding Standby/Hibernation mode
I found an alternative way to avoid standby :)

SetThreadExecutionState(ES_SYSTEM_REQUIRED);
SetThreadExecutionState(ES_DISPLAY_REQUIRED);
Anarchi at 2007-11-10 22:26:10 >