I am trying to generate keyboard keydown and keyup events programmatically. I am currently using CGPostKeyboardEvent to do this, but I am searching for a way to do this at a lower level. I have looked at DDHidLib but could not figure out a way to create a fake event. Can anyone help?
Thanks to weichsel's advice I am now creating a key down event with the following:
CGEventRef e = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)52, true);
- (void) ddhidKeyboard: (DDHidKeyboard *) keyboard
keyDown: (unsigned) usageId;
What's wrong with Quartz Event Services?
I think you are on the right track, but you should use
CGEventCreateKeyboardEvent instead of
CGPostKeyboardEvent because the latter is deprecated since Mac OS X 10.6.