Reputation: 4491
I want to get Keyboard Input on OSX using c++ without using Cocoa, deprecated Carbon UPP handlers and if possible without using IOHID since that's alot of extra work. I allready implemented a simple mouse class using quartz event taps and it works like a charm and now I'd like to use them to implement a keyboard class. Anyways as the reference states under CGEventTapCreate: http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
you can only access key events if one of the following is true:
that is a very serious limitation since I also want my application to work without any weird settings. Is there any way to work around this? If not, is there any alternative to using Taps in Carbon? Thanks!
Upvotes: 3
Views: 2141
Reputation: 26538
You could try to use AXMakeProcessTrusted. This is supposed to be the same as Access for assistive devices on a per process basis.
Upvotes: 2
Reputation: 34185
The easiest way is to use the semi-deprecated Carbon function RegisterEventHotKey
, see this SO Q&A, for example.
If not, you need to live with that restriction. The restriction is there to prevent a bad person to install keylogger behind the scenes. You need to ask the user to open the preferences, type the admin password etc.
Upvotes: 2