Reputation: 40735
I'm building a little app which needs to recognize if certain keys on the keyboard were pressed. In this case the arrow keys. The app must take action when these keys get pressed, even if it's not the frontmost and has no focus.
Is this possible to do? What would I have to do to receive these keyboard events no matter where they happen?
Upvotes: 0
Views: 293
Reputation: 16966
You do this by registering a hotkey using Carbon's RegisterEventHotKey function. There are also open source libraries available that make this easier, for example SGHotKeysLib.
Upvotes: 1