Setting monitor power state in python?
2 answers
After looking at this article:
http://vbnet.mvps.org/index.html?code/screen/scmonitorpower.htm
You seem to need to send a SendMessage call similar to:
SendMessage (Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal MONITOR_OFF)
Although this is the VB version. What you really need is a WinAPI call, I'm sure you can convert this bit so that you make WinAPI calls in Python. Hope this helps.
+1
source to share
import win32gui
import win32con
if argument == "on":
win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND,
win32con.SC_MONITORPOWER, -1)
if argument == "off":
win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND,
win32con.SC_MONITORPOWER, 2)
if argument == "sleep":
win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND,
win32con.SC_MONITORPOWER, 1)
+1
source to share