在 Mac OS 中设置光标位置

发布于 2024-09-15 20:51:58 字数 105 浏览 1 评论 0原文

我想编写一个类似 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

待天淡蓝洁白时 2024-09-22 20:51:58

如果您没有在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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文