可可:模拟Macbook上键&多媒体键 [英] Cocoa: Simulate Macbook upper keys & Multimedia keys

查看:524
本文介绍了可可:模拟Macbook上键&多媒体键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用

CGEventCreateKeyboardEvent (NULL, (CGKeyCode)keycode, true);
CGEventCreateKeyboardEvent (NULL, (CGKeyCode)keycode, false);

到目前为止,我发现并发送了前4个键的事件成功:

So far I found and sent the first 4 key's events succesfully:

keycode / Key

107 - Brightness Down
113 - Brightness Up
130 - Mission Control / Expose
160 - Dashboard / Launchpad
 ?? - Keyboard lit Down
 ?? - Keyboard lit Up
 ?? - Previous Track
 ?? - Play/Pause
 ?? - Next Track
 ?? - Mute
 ?? - Volume Down
 ?? - Volume Up
 ?? - Eject

但我找不到任何其他键码。
我甚至迭代1000整数发送它的数字作为事件,没有人似乎工作= P

But I can't find any of the other key codes. I even iterate through 1000 integer sending its numbers as events, no one seems to work =P

因此,有什么方法来模拟这些

So, is there any way to simulate these events?

谢谢

推荐答案

不被视为正常键盘事件,由于某种原因。 此信息显示了活动的样子。

Media keys are not treated as normal keyboard events, for some reason. This post shows what the events look like.

这篇关于可可:模拟Macbook上键&多媒体键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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