Windows: getting notification about power state changes

Tim Golden mail at timgolden.me.uk
Tue Oct 19 11:30:39 CEST 2010


On 19/10/2010 10:06, Gelonida wrote:
> I'd like to be notified about certain events and call certain python
> functions depending on the event.
>
> call a function:
> - before (or after) the screen saver kicks in
> - before (or after) the monitor is switched off
> - before (or after) the hard disk is switched off
> - before the PC enters stand by mode
>
> - after the PC left stand by mode
> - before (or after) the PC's hard disk was powered up
> - before (or after) the monitor was switched on
> - before (or after) the screen saver was stopped

This should take you a certain amount of the way:

   http://timgolden.me.uk/python/win32_how_do_i/track-session-events.html

I honestly don't know if the OS even knows when the monitor's
switched on / when the disk is spun up.

WMI has some power events:

   http://msdn.microsoft.com/en-us/library/aa394362%28v=VS.85%29.aspx

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

but again I don't know about disk/monitor events.

TJG



More information about the Python-list mailing list