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. I'm used to getting the handles of windows, 
but in this case I'm sending the command to the operating system itself. I'm 
guessing its a DLL call?

There's a link to a working C example here:
http://www.4shared.com/file/11593987/2d23f157/Turn_Your_Monitor_BY_Essawy.html

Does anyone have any tips?







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

Reply via email to