How to simulate a low level keypress on os x?

前端 未结 2 941
误落风尘
误落风尘 2020-12-15 12:15

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

相关标签:
2条回答
  • 2020-12-15 12:44

    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.

    0 讨论(0)
  • 2020-12-15 12:44

    Event taps can inject at the HID level if you run as root

    http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/tdef/CGEventTapLocation

    0 讨论(0)
提交回复
热议问题