Script Hangs in Windows 8.1
Thanks for the script.
I encountered an issue using it in Windows 8.1.
It works fine, however; the script hangs even after I wake my monitors again.
e.g.
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2)
print 'All done'
The Python window stays open even after I wake my monitors i.e. it never reaches the print 'All done' statement.
I tested this on Windows 7 and had no issues so I assume it's a Windows 8.1 issue. I have devised a remedy for my issue
import win32gui import win32con from os import getpid, system from threading import Timer
def force_exit(): pid = getpid() system('taskkill /pid %s /f' % pid)
t = Timer(1, force_exit) t.start() SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2)
The script waits 1 second then forcefully kills itself. The extra imports are part of Python's standard library.
Hi @Wikilicious, thank you for reporting the issue. Could you please do a pull request. Not that i don't have the time, I would like you to be the commit's author.