设置鼠标位置 [英] Set the mouse location

查看:100
本文介绍了设置鼠标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够将鼠标位置设置到屏幕/窗口的中间。
我如何做到这一点?

解决方案

文档似乎表明 CGDisplayMoveCursorToPoint CGWarpMouseCursorPosition 为了配合您的最新评论,我将进一步推荐

CGWarpMouseCursorPosition ,文档的状态为:


例如,此函数通常用于移动光标位置
回到屏幕中心,不需要光标
由显示边缘固定。



I need to be able to set the mouse location to the middle of the screen/window. How can I do that?

解决方案

The documentation seems to indicate that CGDisplayMoveCursorToPoint or CGWarpMouseCursorPosition will do what you're after.

EDIT: To match your latest comment, I would further recommend CGWarpMouseCursorPosition, about which the docs state:

For example, this function is often used to move the cursor position back to the center of the screen by games that do not want the cursor pinned by display edges.

这篇关于设置鼠标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆