How send unicode character to active application?

与世无争的帅哥 提交于 2019-12-05 00:23:00

问题


I need something like SendInput in Windows API.

I see this method, I don't know there is anyway to convert unicode character to virtual Key code.

CGEventRef CGEventCreateKeyboardEvent (
   CGEventSourceRef source,
   CGKeyCode virtualKey,
   bool keyDown
);

回答1:


CGEventRef e = CGEventCreateKeyboardEvent(NULL, NULL, true);
CGEventKeyboardSetUnicodeString(e, unicodeStringLength, unicodeString);   
CGEventPost(kCGHIDEventTap, e);      


来源:https://stackoverflow.com/questions/6943969/how-send-unicode-character-to-active-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!