Inhibit Sleep/Standby in Vista

Giganews Newsgroups
Subject: Inhibit Sleep/Standby in Vista
Posted by:  Graham Powell (grah…@deephaven.co.uk)
Date: Wed, 25 Jun 2008

Anybody know how to do this as well.

I have tried monitoring for PBT_APMQUERYSUSPEND and PBT_APMQUERYSTANDBY in
the WM_POWERBROADCAST message, but they don't happen.

I have also tried calling:

SetThreadExecutionState (ES_CONTINUOUS or ES_SYSTEM_REQUIRED or
ES_DISPLAY_REQUIRED);

But this does not prevent standby or suspend. It does return the correct
value of the current state, so I think it is doing something.

Graham

Replies