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

> Gets the application-local ID that uniquely identifies the input device.

Gets the application-local ID that uniquely identifies the input device.

## Syntax

```cpp theme={null}
void GetDeviceId(
    APP_LOCAL_DEVICE_ID* deviceId
);
```

### Parameters

*deviceId*   \_Out\_\
Type: [APP\_LOCAL\_DEVICE\_ID](https://docs.xbox.com/reference/system/xuser/structs/app_local_device_id.md)\*

Receives the application-local ID of the device.

### Return value

Type: void

## Remarks

The device ID is an application-local ID: a 256-bit hash value that uniquely identifies the device. This ID stays the same for a given device, even across runs of an application or reboots of the system, as long as the device connects to the same USB port. The hash is generated partly from information that's specific to the calling application and system, so the same device has different IDs in different applications.

Because the ID is stable, you can store it to remember a device, such as a user's preferred controller, and later look up the matching device object by calling [IGameInput::FindDeviceFromId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md).

For devices that are one of several interfaces on a composite device, use [IGameInputDevice::GetDeviceRootId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md) to get the ID of the root device. If the device isn't part of a composite device, the device ID and the root device ID are the same.

In GameInput v3 and earlier, this information was available from the `deviceId` 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::GetDeviceRootId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md)\
[IGameInput::FindDeviceFromId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md)\
[APP\_LOCAL\_DEVICE\_ID](https://docs.xbox.com/reference/system/xuser/structs/app_local_device_id.md)

## Version History

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


## Related topics

- [IGameInputDevice::GetDeviceRootId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md)
- [Users and input devices](https://docs.xbox.com/build/core-features/common/user/users-input-devices.md)
- [IGameInputDevice::IsConnected](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_isconnected.md)
- [IGameInputDevice (Interface contents)](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)
- [IGameInputDevice::GetVendorId](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getvendorid.md)
