You can’t make win32api.SendMessage()
non-blocking because the underlying Windows function is blocking. Instead you can use win32api.PostMessage()
, it has the same signature:
import win32api, win32con
print "start"
win32api.PostMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, win32con.SC_MONITORPOWER, 2)
print "end"
3
solved How to make SendMessage unblocking?