Alec Bennett wrote:
I'm trying to turn a monitor off from a Python script. I can do this using the program
"wizmo", so its possible from Windows. I found this script which describes a
method using SendMessage:
http://fci-h.blogspot.com/2007/03/turn-off-your-monitor-via-code-c.html
Translated to Python, here's what I have so far:
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2)
That follows this general structure:
SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal MONITOR_OFF)
My problem is getting the handle.
The article you mention suggests using the desktop window handle --
available via GetDesktopWindow (). You might try that?
TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32