[python-win32] registering for power events

Tim Golden mail at timgolden.me.uk
Tue Dec 15 19:41:38 CET 2009


Ross Boylan wrote:
> I would like my application to get notice when the system sleeps,
> hibernates, or wakes up.
> http://msdn.microsoft.com/en-us/library/aa373196(VS.85).aspx
> points me to RegisterPowerSettingNotification, but I do not see this in
> the latest docs from ActiveState.  MSDN only seems to provide a C++
> interface; I don't see any COM interface.
> 
> I think this is new in Vista.  Is there a way to do this from Python?

FWIW you can do this on XP via WMI:

http://timgolden.me.uk/python/wmi/cookbook.html#monitor-multiple-machines-for-power-events

TJG


More information about the python-win32 mailing list