[python-win32] How to find the current/last system state from Python

Tim Roberts timr at probo.com
Thu Jul 5 19:21:17 CEST 2012


prashant padaganur wrote:
>
> Tim this might be something similar, but what I am looking for is
> sleep state. I want the exact api which exposes/returns the
>  SYSTEM_POWER_STATE enum either thru win32ap or wmi.

It's a little difficult to figure out what you want.  When the system
goes into a sleep state, user mode applications stop running.  If you
are writing a command to change the current power state, then you may
safely assume that the system is in S0.  Otherwise, your command could
not have been started.

There are only two possible transitions:  from working (S0) to a
sleeping state (S1-S5), and from a sleeping state to working (S0).  The
operating system will not go from standby directly to hibernate; it has
to make an intermediate stop in S0.

http://www.osronline.com/ddkx/kmarch/pwrmgmt_919j.htm

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list