Been trying for months to get a click without moving mouse
Why isn’t this working?
It’s like this click just doesn’t register, I’m at an absolute loss
import win32gui
import win32api
import win32con
import time
from win32gui import GetWindowText, GetForegroundWindow
def control_click(x, y, handle, button='left'):
l_param = win32api.MAKELONG(x, y)
if button == 'left':
win32gui.PostMessage(handle, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, l_param)
win32gui.PostMessage(handle, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, l_param)
elif button == 'right':
win32gui.PostMessage(handle, win32con.WM_RBUTTONDOWN, 0, l_param)
win32gui.PostMessage(handle, win32con.WM_RBUTTONUP, 0, l_param)
print(GetWindowText(GetForegroundWindow()))
time.sleep(2)
h = GetForegroundWindow()
time.sleep(1)
print("click")
control_click(264, 74, h)
time.sleep(10)