Borland C ++ Builder FAQ
The content The last update: 12/12/2008

How program to push a key?

The author: OlegGG
The initial link: - - -

I will give an example for a key "NumLock":

IN 9x:
BYTE KeyboardState [256]; 
GetKeyboardState (KeyboardState); 
KeyboardState [VK_NUMLOCK] = KeyboardState [VK_NUMLOCK] ^ 1; 
SetKeyboardState (KeyboardState); 
IN NT/2000/XP:
keybd_event (VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0); 
keybd_event (VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);