I am attempting to emulate a mouse click without actually moving the mouse, my current function works perfectly:
def control_click(x, y, handle):
l_param = win32api.MAKELONG(x, y)
win32gui.PostMessage(handle, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, l_param)
win32gui.PostMessage(handle, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, l_param)
However, it only works for the primary screen, I'm using a second monitor and I'd like to have this run on the second monitor instead of in the main monitor, I've tried changing the coordinates (which I check using a coordinate spy tool) however haven't been successful at all.
Example:
X= 120
Y= 90
Clicks exactly where I want in my primary monitor. However, moving the window to my second monitor, the X should be -1810 according to my spy tool, however, it's not clicking. Also tried simply inserting the coordinates relative to the client since I'm using a handle, however, it also does not work for some reason.
What am I doing wrong or rather what should I be doing to make it work in the second monitor?
EDIT: So I noticed that if I have the window up but not completely "maximized", when it's smaller, occupying like half the screen, the coordinates "45,76" work and it clicks, however, the moment I turn it to full screen(or rather, maximizing it) it suddenly stops working no matter what coordinates I seem to input.