> ## 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::GetDisplayName

> Gets the friendly display name of the input device as a UTF-8 string.

Gets the friendly display name of the input device as a UTF-8 string.

## Syntax

```cpp theme={null}
uint32_t GetDisplayName(
    uint32_t bufferByteCount,
    char* buffer
);
```

### Parameters

*bufferByteCount*   \_In\_\
Type: uint32\_t

The size, in bytes, of the buffer pointed to by *buffer*. Pass 0 to query the required size.

*buffer*   \_Out\_writes\_bytes\_opt\_(bufferByteCount)\
Type: char\*

The buffer that receives the null-terminated UTF-8 display name. Pass `nullptr` to query the required size.

### Return value

Type: uint32\_t

The size, in bytes, of the buffer required to hold the display name, including the null terminator.

## Remarks

The method writes the display name to *buffer* only if *buffer* isn't `nullptr` and *bufferByteCount* is greater than or equal to the required size. Otherwise, the buffer isn't modified. To retrieve the display name, call the method once with a *bufferByteCount* of 0 and a *buffer* of `nullptr` to get the required size, allocate a buffer of that size, and then call the method again.

If the device doesn't have a display name, the required size is 1, and the method writes an empty string.

The display name is a "friendly" name for the device. You can display it in your application's UI, but it isn't guaranteed to be localized. GameInput searches several locations for this string, and one of the final fallbacks is the device's firmware.

The display name doesn't change for the lifetime of the device object.

The following example retrieves the display name of a device.

```cpp theme={null}
std::string GetDeviceDisplayName(IGameInputDevice* device)
{
    const uint32_t size = device->GetDisplayName(0, nullptr);
    if (size == 0)
    {
        return {};
    }

    std::vector<char> buffer(size);
    device->GetDisplayName(size, buffer.data());

    return std::string(buffer.data());
}
```

In GameInput v3 and earlier, this information was available from the `displayName` 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)\
[IGameInputDevice](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[IGameInputDevice::GetPnpPath](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getpnppath.md)

## Version History

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


## Related topics

- [IGameInputDevice::GetPnpPath](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getpnppath.md)
- [IGameInputDevice::GetSupportedInput](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md)
- [IGameInputDevice::GetDeviceFamily](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicefamily.md)
- [IGameInputDevice::GetDeviceId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md)
- [IGameInputDevice::GetXInputDeviceIndex](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getxinputdeviceindex.md)
