问题
Cursor.Position, SetCursorPos(), SendInput() and mouse_event() all set the mouse position to a specified coordinate.
So what's the difference between them?
回答1:
Cursor.Position and SetCursorPos can only be used to change the cursor position.
Cursor.Positionis Windows Forms;SetCursorPosis Win32.SendInput and mouse_event can be used to change the cursor position as well as generate mouse clicks and mouse wheel events.
SendInputis the current API; in addition to generating mouse events, it can also generate keyboard input.mouse_eventis an earlier, deprecated API.
来源:https://stackoverflow.com/questions/1503238/whats-the-difference-between-using-cursor-position-setcursorpos-sendinput