XPLM_API int        XPLMRegisterKeySniffer(
                         XPLMKeySniffer_f     inCallback,    
                         int                  inBeforeWindows,    
                         void *               inRefcon);    

This routine registers a key sniffing callback. You specify whether you want to sniff before the window system, or only sniff keys the window system does not consume. You should ALMOST ALWAYS sniff non-control keys after the window system. When the window system consumes a key, it is because the user has “focused” a window. Consuming the key or taking action based on the key will produce very weird results. Returns 1 if successful.