如何将Unicode字符发送到活动应用程序? [英] How send unicode character to active application?
本文介绍了如何将Unicode字符发送到活动应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要Windows API中的SendInput之类的东西.
I need something like SendInput in Windows API.
我看到了这种方法,我不知道有没有将Unicode字符转换为虚拟键代码的方法.
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
);
推荐答案
CGEventRef e = CGEventCreateKeyboardEvent(NULL, NULL, true);
CGEventKeyboardSetUnicodeString(e, unicodeStringLength, unicodeString);
CGEventPost(kCGHIDEventTap, e);
这篇关于如何将Unicode字符发送到活动应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文