我在Windows API中需要类似SendInput的东西.
我看到这个方法,我不知道无论如何都要将unicode字符转换为虚拟Key代码.
CGEventRef CGEventCreateKeyboardEvent (
CGEventSourceRef source,
CGKeyCode virtualKey,
bool keyDown
);
Run Code Online (Sandbox Code Playgroud)
CGEventRef e = CGEventCreateKeyboardEvent(NULL, NULL, true);
CGEventKeyboardSetUnicodeString(e, unicodeStringLength, unicodeString);
CGEventPost(kCGHIDEventTap, e);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
694 次 |
| 最近记录: |