Export (0) Print
Expand All
4 out of 12 rated this helpful - Rate this topic

SetKeyboardState function

Copies an array of keyboard key states into the calling thread's keyboard input-state table. This is the same table accessed by the GetKeyboardState and GetKeyState functions. Changes made to this table do not affect keyboard input to any other thread.

Syntax


BOOL WINAPI SetKeyboardState(
  _In_  LPBYTE lpKeyState
);

Parameters

lpKeyState [in]

Type: LPBYTE

A pointer to a 256-byte array that contains keyboard key states.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK (or the Japanese KANA) indicator lights on the keyboard. These can be set or cleared using SendInput to simulate keystrokes.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
GetAsyncKeyState
GetKeyboardState
GetKeyState
keybd_event
MapVirtualKey
SendInput
Conceptual
Keyboard Input

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.