There is no reliable method for sending keystrokes to a specific target without that target having window focus (this is how Windows is designed).
Does the game itself not have TrackIR controls? Most flight sims that support TrackIR that I know of have built-in (possibly optional, I.E. not assigned by default) keybinds for it.