A
Astan Chee
Hi,
I'm trying to turn off my monitor, pause and then turn it on again.
I'm doing this in python 2.6 and windows xp. Here is my script so far
(that doesn't work):
import time
import win32gui
import win32con
import win32api
def turnOffMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2)
def turnOnMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
if __name__ == "__main__":
turnOffMonitor()
time.sleep(5)
turnOnMonitor()
For some reason, the script doesn't turn the monitor back on. What am
I doing wrong here or are there any other alternative?
I'm trying to turn off my monitor, pause and then turn it on again.
I'm doing this in python 2.6 and windows xp. Here is my script so far
(that doesn't work):
import time
import win32gui
import win32con
import win32api
def turnOffMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2)
def turnOnMonitor():
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST,
win32con.WM_SYSCOMMAND, SC_MONITORPOWER, -1)
if __name__ == "__main__":
turnOffMonitor()
time.sleep(5)
turnOnMonitor()
For some reason, the script doesn't turn the monitor back on. What am
I doing wrong here or are there any other alternative?