远程控制鼠标的Apple事件 [英] Apple Events to Control Mouse Remotely
问题描述
我甚至不确定从这个问题开始...
我想能够将鼠标点击事件发送到另一台机器,
我可以在同一台机器上通过以下方式进行:
CGEventSourceRef source = CGEventSourceCreate(NULL);
CGEventType eventType = kCGEventLeftMouseDragged;
CGPoint mouseCursorPosition;
mouseCursorPosition.x = point.x;
mouseCursorPosition.y = point.y;
CGMouseButton mouseButton = kCGMouseButtonLeft;
CGEventRef mouseEvent = CGEventCreateMouseEvent(source,
eventType,
mouseCursorPosition,
mouseButton);
CGEventSetType(mouseEvent,kCGEventLeftMouseDragged); //修复Apple Bug
CGEventPost(kCGSessionEventTap,mouseEvent);
CFRelease(mouseEvent);
但是如何在别的地方发送该事件?苹果手?我已经读过一些与AppleEvents进行应用程序通信的东西,但我想在另一台机器上生成一个系统事件?
完全不确定。 >
感谢,
只是为了澄清,我没有寻找屏幕共享。至少我不这么认为。我有一个几个mac的链接在一起,每个有4个显示器。我试图只使用1个设备来传达点击到每个节点。因此,如果设备在节点3上,但设备插入节点0,则节点0需要告诉节点3它需要响应点击。
谢谢, / p>
真的吗?没有人能给我一个具体的代码示例生成Apple Events以编程方式在C / C ++ / Objc-C中的远程机器上创建鼠标事件
这可能涉及编写设备驱动程序并伪装成鼠标。
I'm not even sure where to begin with this question...
I want to be able to send mouse-click events to another machine, as if the user had clicked on that machine.
I can do it on the same machine via:
CGEventSourceRef source = CGEventSourceCreate(NULL);
CGEventType eventType = kCGEventLeftMouseDragged;
CGPoint mouseCursorPosition;
mouseCursorPosition.x = point.x;
mouseCursorPosition.y = point.y;
CGMouseButton mouseButton = kCGMouseButtonLeft;
CGEventRef mouseEvent = CGEventCreateMouseEvent ( source,
eventType,
mouseCursorPosition,
mouseButton );
CGEventSetType(mouseEvent, kCGEventLeftMouseDragged); // Fix Apple Bug
CGEventPost( kCGSessionEventTap, mouseEvent );
CFRelease(mouseEvent);
But how do I send that event somewhere else? Applescript? I've read some stuff with AppleEvents being app-app communication, but I'd like to just generate a system event on another machine?
Totally unsure.
Thanks,
[Edit 11/1/10 7:30a]
Just to clarify, I'm not looking to screen share. At least I don't think so. I've got a cluster of several mac pros linked together, each has like 4 monitors. I'm trying to use only 1 device to communicate "clicks" to each of the nodes. So if the device is over node 3, but the device is plugged into node0, node0 needs to tell node 3 that it needs to respond to a click.
Thanks,
[Edit 11/4/10 9:32am]
Really? Nobody can give me a concrete code example of generating Apple Events Programmatically to create mouse events on remote machines in C/C++/Objc-C???
This will probably involve writing a device driver and pretending to be a mouse.
这篇关于远程控制鼠标的Apple事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!