How to send Unicode character to active application?

I need something like SendInput in the Windows API.

I see this method, I don’t know, anyway, to convert the Unicode character to virtual Key code.

CGEventRef CGEventCreateKeyboardEvent (
   CGEventSourceRef source,
   CGKeyCode virtualKey,
   bool keyDown
);
+5
source share
1 answer
CGEventRef e = CGEventCreateKeyboardEvent(NULL, NULL, true);
CGEventKeyboardSetUnicodeString(e, unicodeStringLength, unicodeString);   
CGEventPost(kCGHIDEventTap, e);      
+5
source

All Articles