> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IGameInputDevice::GetKeyboardInfo

> Retrieves the keyboard properties of the device, such as its keyboard kind, layout, and key count.

Retrieves the keyboard properties of the device, such as its keyboard kind, layout, and key count.

## Syntax

```cpp theme={null}
bool GetKeyboardInfo(
    GameInputKeyboardInfo* info
);
```

### Parameters

*info*   \_Out\_\
Type: [GameInputKeyboardInfo](https://docs.xbox.com/reference/input/gameinput/structs/gameinputkeyboardinfo.md)\*

Pointer to a `GameInputKeyboardInfo` structure that receives the keyboard properties of the device. If the device doesn't support keyboard input, every member of the structure is set to zero.

### Return value

Type: bool

`true` if the device supports keyboard input and *info* was filled in; otherwise, `false`.

## Remarks

The `GetKeyboardInfo` method copies the keyboard properties of the device into the caller-provided structure. A device supports keyboard input when the value returned by [GetSupportedInput](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) includes `GameInputKindKeyboard`. If the device doesn't support keyboard input, `GetKeyboardInfo` zero-initializes *info* and returns `false`.

Most keyboard properties are fixed for the lifetime of the device. The exception is the `layout` member, which GameInput updates in place when the active keyboard layout changes (for example, when the user switches input languages). When the layout changes, GameInput raises the `GameInputDeviceEventKeyboardLayoutUpdated` [GameInputDeviceEvent](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/enums/gameinputdeviceevent) to device callbacks registered with [IGameInput::RegisterDeviceCallback](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md). Call `GetKeyboardInfo` again from that callback to read the new layout.

The following example shows how to query the keyboard properties of a device.

```cpp theme={null}
GameInputKeyboardInfo info;
if (device->GetKeyboardInfo(&info))
{
    uint32_t keyboardLayout = info.layout;
    uint32_t keyCount = info.keyCount;
    // ...
}
```

In GameInput v3 and earlier, this information was available from the `keyboardInfo` member of the [GameInputDeviceInfo](https://docs.xbox.com/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) structure returned by [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md).

## Requirements

**Header:** GameInput.h

**Library:** gameinput.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[Overview of GameInput](https://docs.xbox.com/build/core-features/common/input/overviews/input-overview.md)\
[GameInputKeyboardInfo](https://docs.xbox.com/reference/input/gameinput/structs/gameinputkeyboardinfo.md)\
[GetSupportedInput](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md)\
[GameInputKind](https://docs.xbox.com/reference/input/gameinput/enums/gameinputkind.md)\
[IGameInput::RegisterDeviceCallback](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md)\
[GameInputDeviceEvent](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/enums/gameinputdeviceevent)\
[IGameInputReading::GetKeyState](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getkeystate.md)\
[IGameInputDevice](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## Version History

| Version | Changes |
| - | - |
| **v4** | Introduced. |


## Related topics

- [GameInputKeyboardInfo](https://docs.xbox.com/reference/input/gameinput/structs/gameinputkeyboardinfo.md)
- [IGameInput::RegisterKeyboardLayoutCallback (Deprecated)](https://docs.xbox.com/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_registerkeyboardlayoutcallback.md)
- [IGameInput::RegisterDeviceCallback](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md)
- [IGameInputDevice::GetDeviceRootId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md)
- [IGameInputDevice::GetInputReportInfo](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md)
