Someone did a decls for the WinAPI which has SendMessage() and PostMessage() functions available. These can be used to place keyboard messages directly into the message queue of a window that you know the windowsHandle for.
... might be a starting point for further investigation.
... might be a starting point for further investigation.