What's the difference between using Cursor.Position, SetCursorPos(), SendInput() and mouse_event()?

有些话、适合烂在心里 提交于 2019-12-07 18:43:10

问题


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.Position is Windows Forms; SetCursorPos is Win32.

  • SendInput and mouse_event can be used to change the cursor position as well as generate mouse clicks and mouse wheel events. SendInput is the current API; in addition to generating mouse events, it can also generate keyboard input. mouse_event is an earlier, deprecated API.



来源:https://stackoverflow.com/questions/1503238/whats-the-difference-between-using-cursor-position-setcursorpos-sendinput

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!