void SetKeyboardState(lpbKeyState) | |||||
BYTE FAR* lpbKeyState; | /* address of array with virtual-key codes | */ |
The SetKeyboardState function copies a 256-byte array of keyboard key states into the Windows keyboard-state table.
lpbKeyState
Points to a 256-byte array that contains keyboard key states.
This function does not return a value.
In many cases, an application should call the GetKeyboardState function first to initialize the 256-byte array. The application should then change the desired bytes.
SetKeyboardState sets the LEDs and BIOS flags for the NUMLOCK, CAPSLOCK, and SCROLL LOCK keys according to the toggle state of the VK_NUMLOCK, VK_CAPITAL, and VK_SCROLL entries of the array.
For more information, see the description of the GetKeyboardState function.
The following example simulates the pressing of the CTRL key:
BYTE pbKeyState[256];
GetKeyboardState((LPBYTE) &pbKeyState);
pbKeyState[VK_CONTROL] |= 0x80;
SetKeyboardState((LPBYTE) &pbKeyState);