Eureka! In case anyone else comes down this path, the trick is to use 
HWND_BROADCAST to send the message to all windows. So the code to turn off all 
monitors:

SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, 
SC_MONITORPOWER, 2)

According to the documentation, that last parameter (the 2) could be a 1 for 
low power (not sure if any Windows computers support this?), or a -1 to turn 
the monitor back on.

Of course you can always turn the monitor back on by moving the mouse or 
hitting a key.






      
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to