Win32: mouse movement using SetCursorPos vs mouse_event

Is there a difference between moving the mouse in windows using the following two methods?

win32api.SetCursorPos((x,y))

against

nx = x*65535/win32api.GetSystemMetrics(0)
ny = y*65535/win32api.GetSystemMetrics(1)
win32api.mouse_event(win32con.MOUSEEVENTF_ABSOLUTE|win32con.MOUSEEVENTF_MOVE,nx,ny)

Does something happen differently in the way Windows handles movement?

+3
source share
1 answer

I believe that it mouse_eventworks by inserting events into the mouse input stream, where it SetCursorPossimply moves the cursor around the screen. I do not believe that SetCursorPos will generate any input events (although I may be wrong).

, SetCursorPos . mouse_event, , , , . , , ; , . , mouse_event, /, , .

+4

Source: https://habr.com/ru/post/1764955/


All Articles