Use this function it can be usefull.
int FakeKeystroke (int Keycode);
This function simulates a keystroke by posting a keystroke event to the currently
active panel.
This function has the same effect as actually pressing a key at the keyboard.
Note: The order in which the fake keystroke is received in relation to other
events is not defined, so you must use this function with care.
Find the function panel in the user interface library
Hope it helps.