在 Mac OS 中设置光标位置
我想编写一个类似 vnc 的小程序,将 Mac OS 光标移动到通过从 Bonjour 服务获取数据的协议给出的位置(x,y)。问题是我不知道如何移动光标!
我正在和可可一起工作。
I want to write a little vnc similar program that moves the Mac OS cursor to a position (x, y) given through a protocol which gets data from Bonjour service. The problem is that I don't know how to move the cursor!
I'm working with Cocoa.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您没有在Quartz Display Services中查找此服务,这是情有可原的。您需要的功能是
CGWarpMouseCursorPosition
。由于文档没有说明,您必须进行实验以确定它使用哪个坐标系 - 即原点在哪里以及正 y 的方向。
You can be forgiven for not looking in Quartz Display Services for this one. The function you're after is
CGWarpMouseCursorPosition
.Since the documentation doesn't say, you'll have to experiment to determine which coordinate system it uses — i.e., where the origin is and which way positive y goes.