使用 GetEventMonitorTarget() 时抑制默认事件处理程序
我有一个从 Apple 事件处理示例。看起来像:
InstallEventHandler(GetEventMonitorTarget(), MonitorHandler, GetEventTypeCount(kEvents), kEvents, 0, &sHandler );
GetEventMonitorTarget() 的作用就是获取其他应用程序的事件。但从我读到的情况来看,该事件有点分叉,既发送到我的应用程序又发送到目标应用程序。因此,即使我从处理程序函数返回 noErr 并试图阻止默认处理程序执行应用程序,仍然会处理该事件。
有没有办法抑制默认处理程序,或者更具体地说,抑制目标应用程序处理事件?
I have an application that borrows code from the Apple event handling sample. It looks like:
InstallEventHandler(GetEventMonitorTarget(), MonitorHandler, GetEventTypeCount(kEvents), kEvents, 0, &sHandler );
GetEventMonitorTarget() is all about getting events for other applications. But from what I've read the event is sort of forked, sent both to my application and to the target application. Because of that, even if I return noErr from my handler function with the intent to keep the default handler from executing the application still also handles the event.
Is there a way to suppress the default handler, or more specifically, the target application from handling the event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试创建热键,创建热键。
如果您尝试执行其他操作,创建事件点击。
If you're trying to make a hot key, make a hot key.
If you're trying to do something else, create an event tap.