win12.hlp (Table of Contents; Topic list)
WinSetKeyboardStateTable (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WININPUT
 
BOOL WinSetKeyboardStateTable(hwndDesktop, pKeyStateTable, fSet)
HWND hwndDesktop;        /* handle of the desktop    */
PBYTE pKeyStateTable;    /* address of the key table */
BOOL fSet;               /* set/copy flag            */
 
The WinSetKeyboardStateTable function gets or sets the keyboard state. This
function does not change the physical state of the keyboard; it changes the
value returned by the WinGetKeyState function, not the value returned by the
WinGetPhysKeyState function.
 
To set the state of a single key you must get the entire table, modify the
individual key, and then set the table from the modified value.
 
Parameter       Description
────────────────────────────────────────────────────────────────────────────
 
hwndDesktop     Identifies the desktop window. This parameter can be
                HWND_DESKTOP or the desktop window handle.
 
pKeyStateTable  Points to a 256-byte table indexed by virtual-key value. For
                any virtual key, the 0x80 bit is set if the key is down and
                cleared if it is up. The 0x01 bit is set if the key is
                toggled (pressed an odd number of times) and cleared
                otherwise.
 
fSet            Specifies whether the keyboard state is set or copied. If
                this parameter is TRUE, the keyboard state is set from
                pKeyStateTable. If this parameter is FALSE, the keyboard
                state is copied to pKeyStateTable.
 
Return Value
 
The return value is TRUE if the function is successful or FALSE if an error
occurs.
 
See Also
 
WinGetKeyState, WinGetPhysKeyState