is currently developing a script, and as a result, I encountered such a strange thing.
found that when the handle was successfully obtained and the program was in the minimization / background, the code simulated by the last key would work.
but the above two lines of mouse code did not work. At first,
felt that the program had blocked the api.
but later found that the sentence back1 is valid when the program window is on the desktop but there is no focus,
but back2 never works,
individuals have a guess that the code works, but it doesn"t click to the right place, and the window doesn"t respond, which leads to the idea that it doesn"t work.
however, this conjecture, which I operate with a chrome browser, can be triggered by a click event in the correct coordinates. So I"m not sure if this guess is correct.
in addition, after querying, I found that after enabling DirectX, some programs will bypass the message mechanism of windows, resulting in the invalidation of the SendMessage. Maybe this is also the reason, so what should be used in this case?
Please give me your advice!
back1-left mouse button presses
back2-left mouse button pops up
long_position-Click coordinates
hwnd-window coordinates
XMagi y-background mouse click coordinates
long_position = win32api.MAKELONG (x, y)
time.sleep
back1 = win32api.SendMessage (hwnd,win32con.WM_LBUTTONDOWN,win32con.MK_LBUTTON,long_position)
time.sleep-sharp uplink and downlink code does not work (or has no effect)
back2 = win32api.SendMessage (hwnd,win32con.WM_ LBUTTONUP, win32con.MK_LBUTTON,long_position)
time.sleep
win32api.SendMessage (hwnd,win32con.WM_KEYFIRST,68,None)-sharp works
ask for advice!