SetThreadExecutionState / CallNtPowerInformation(SystemExecutionState)

SetThreadExecutionState / CallNtPowerInformation(SystemExecutionState)

Post by jim clar » Fri, 14 Mar 2008 00:59:47

I would be very grateful if anyone could answer the following:

1. I'm using SetThreadExecutionState with flags ES_SYSTEM_REQUIRED and
ES_CONTINUOUS to prevent a system from sleeping. When I don't need the
system to stay awake anymore I call it again with only ES_CONTINUOUS set -
my understanding is that this clears the previous flags and allows the idle
counter to start working again. Sometimes however, the system still refuses
to idle after the second call - Is it possible that calling again with only
ES_CONTINUOUS set would reset the idle timer again (I don't do this very
frequently but possible once every few minutes)?

Or, to put it another way:

2. You can determine the current state by calling
CallNtPowerInformation(SystemExecutionState, ...) .If this reports that
ES_SYSTEM_REQUIRED (or similar) is set is there anyway to find which thread
(or even better just which process) has done this. I have a situation where
something is setting the flag but I don't seem to have anyway to find out

Best Regards


1. CallNtPowerInformation help in windows 7

2. No Suspend after SetThreadExecutionState() call


I'm having trouble using SetThreadExecutionState() on Win XP SP2. I'm
trying to prevent the PC from going into any of the low power states while
using my driver. Inside my code, I make a call to
SetThreadExecutionState(ES_SYSTEM_REQUIRED) to reset the timer. I end my
program after making this call successfully. At this point, I would expect
to be able to enter the low power states after the user specified time has
expired, but the PC NEVER suspends again until after a reboot. The PC
suspends fine if I never make the call to SetThreadExecutionState().

Has anyone run into this problem?

I'm using a DELL Latitude D600, 1.4 GHz Pentium M, 512 MB Memory.

3. Retrieve list of processes using SetThreadExecutionState()

4. Get the state of "SetThreadExecutionState Function"

5. Anyone ever use SetThreadExecutionState from VB6?

6. xperf and SetThreadExecutionState()

7. Need help with Declaration for SetThreadExecutionState

8. SetThreadExecutionState and crash in XP if "Prompt for password..."

9. SetThreadExecutionState