GetKeyboardType function (winuser.h)

Retrieves information about the current keyboard.

Syntax

int GetKeyboardType(
  [in] int nTypeFlag
);

Parameters

[in] nTypeFlag

Type: int

The type of keyboard information to be retrieved. This parameter can be one of the following values.

Value Meaning
0 Keyboard type
1 Keyboard subtype
2 The number of function keys on the keyboard

Return value

Type: int

If the function succeeds, the return value specifies the requested information.

If the function fails and nTypeFlag is not 1, the return value is 0; 0 is a valid return value when nTypeFlag is 1 (keyboard subtype). To get extended error information, call GetLastError.

Remarks

Valid keyboard types are:

Value Description
0x4 Enhanced 101- or 102-key keyboards (and compatibles)
0x7 Japanese Keyboard
0x8 Korean Keyboard
0x51 Unknown type or HID keyboard

Keyboard subtypes are original equipment manufacturer (OEM)-dependent values.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Keyboard Input Functions