[python-win32] Detecting when the Windows screen saver comes on

Tim Golden mail at timgolden.me.uk
Wed Feb 27 21:11:50 CET 2008

happybrowndog wrote:
> Hello,
> Does anyone know how to detect when the windows screen saver comes on? 
> Any other kind of detection of windows being idle (ie: sleep or 
> whatever) would also be useful if you happen to know it.  I'm basically 
> looking for whatever is easy to implement.  My wxpython chat application 
>   needs to know if the user has gone "idle" by detecting whatever 
> windows event will tell me that.

There *are* -- slightly awkward -- ways of doing such things
(eg a combination of polling the GetSystemParameterInfo with
the right flags and / or monitoring for a system power event)
but I came across this article:


which would seem to be do-able in Python with ctypes. Haven't
tried it myself, mind you.


More information about the python-win32 mailing list