I’m currently coding an app that has hotkey functionality, I’ve done some reading and was surprised to see it is all done via an old Carbon API. However, perhaps the biggest dilemma is I am unable to calculate the “Keyboard Reference Number”s it requires.
The only app I have seen that makes this possible (ASyncKey) won’t work anymore as it was a Classic app.
While the API to create hotkeys is a Carbon API, I wouldn’t necessarily call it an “old” API; it’s been updated to work for 64-bit apps and was the topic of one of the sessions at this year’s WWDC (Session #145).
As for your question, I’m not quite sure what you mean. I got sick of trying to deal with (what I thought was) the class bloat of wrappers like PTHotKey, so I wrote my own. You can peruse the source on Github: http://github.com/davedelong/DDHotKey Hopefully that will help you figure out what’s going on.
edit Key codes are how you indicate which key you want to tie your code to. These key codes are the “virtual” key codes, and they can be acquired in one of two ways:
HIToolbox/Events.hand finding which key you want-[NSEvent keyCode]Even projects like ShortcutRecorder use one of these 2 approaches. I’m not aware of any others.