OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to make SendMessage unblocking?

  • Thread starter Thread starter gre_gor
  • Start date Start date
G

gre_gor

Guest
I have this script to turn the monitors off:

Code:
import win32api, win32con

print "start"
win32api.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, win32con.SC_MONITORPOWER, 2)
print "end"

"end" isn't printed and the script never ends.
It's annoying when the terminal windows stays open.

How do I make SendMessage non-blocking?
<p>I have this script to turn the monitors off:</p>
<pre><code>import win32api, win32con

print "start"
win32api.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, win32con.SC_MONITORPOWER, 2)
print "end"
</code></pre>
<p><code>"end"</code> isn't printed and the script never ends.<br />
It's annoying when the terminal windows stays open.</p>
<p>How do I make <code>SendMessage</code> non-blocking?</p>
 

Latest posts

M
Replies
0
Views
1
MOHAMED AMIIN ABDI AADAN
M
Top