I originally posted the question here , please help ,thank you !
I want to hook the left mouse button down event on any window, my code as
following :
import win32guiimport win32uiimport win32condef onMousePressed(self):
print('onMousePressed', win32gui.GetCursorPos())def listener():
windowHandle = win32gui.WindowFromPoint(win32gui.GetCursorPos())
clickedWindow = win32ui.CreateWindowFromHandle(windowHandle)
clickedWindow.HookMessage(onMousePressed, win32con.WM_LBUTTONDOWN)
# print('-------------registerMouseEvent', clickedWindow)whileTrue:
listener()
However , the onMousePressed function was never called when clicked, what is
wrong ?
P.S. I know some similar projects such as PyUserInput, mouse, pynput, just want
to know why my code didn't work.
_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32