I'm making a code in python to simulate a mouse press to a window. My current code is:
def MousePress_Pos(x, y):
pos = MAKELONG(x, y)
SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, pos)
SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, pos)
This code is successfully simulating a mouse press but it doesn't do it on the given X and Y. Instead, it presses on the current X and Y of my mouse!
This is also happening when the window is not focused. It just ignores the given X and Y and presses on the window with the mouse's X and Y.
I have no idea why this happens. Does anybody know what should I do? Thanks.