In Cocoa/ Objective C I need to be able to programmatically find out which app or process has the keyboard focus. This may be done by doing a 'hit-test', but I'm not exactly sure.
I also need to get the process ID number and Window Title of app that has the keyboard focus.
Objective C or C only please!
Snippets appreciated!