Last active
August 29, 2015 14:02
-
-
Save asus4/d094eb255442dd15843f to your computer and use it in GitHub Desktop.
Create Mac native key events ref: http://qiita.com/asus4/items/a2517aed8dc7e4773c34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) keyEmulate { | |
CGEventRef keyup, keydown; | |
keydown = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)40, true); | |
keyup = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)40, false); | |
CGEventPost(kCGHIDEventTap, keydown); | |
CGEventPost(kCGHIDEventTap, keyup); | |
CFRelease(keydown); | |
CFRelease(keyup); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment