XPLMTakeKeyboardFocus

XPLM_API void       XPLMTakeKeyboardFocus(
                         XPLMWindowID         inWindow);    

This routine gives a specific window keyboard focus. Keystrokes will be sent to that window. Pass a window ID of 0 to remove keyboard focus from any plugin-created windows and instead pass keyboard strokes directly to X-Plane.