Skip to main content

IGameInput::RegisterDeviceCallback

Registers a GameInputDeviceCallback function to be called whenever a device is connected or disconnected from the system. Also allows the function to be called when the properties of a device change.

Syntax

Parameters

device   _In_opt_
Type: IGameInputDevice*
Limits registered callback to only trigger for a specific device. inputKind   _In_
Type: GameInputKind
Limits registered callback to only trigger for devices that support at least one of the specified types of input. statusFilter   _In_
Type: GameInputDeviceStatus
Limits registered callback to only trigger for specific types of device status changes. enumerationKind   _In_
Type: GameInputEnumerationKind
Determines whether devices will be enumerated and if the function will wait for enumeration to complete. context   _In_opt_
Type: void*
Some object which provides relevant information for the callback function. Typically the calling object. callbackFunc   _In_
Type: GameInputDeviceCallback
The title-defined callback to register for the device connected or disconnected event. callbackToken   _Result_zeroonfailure_
Type: GameInputCallbackToken*
Token identifying the registered callback function. This token is used to identify the registered function in the event that you need to cancel or unregister the callback function.

Return value

Type: HRESULT Function result.

Remarks

The function registered by IGameInput::RegisterDeviceCallback can be used to react to changes of state in the device, such as a connect or disconnect. The types of recognizable state changes are listed in GameInputDeviceStatus. The enumerationKind parameter can be used to cause an initial salvo of callbacks to be generated - one for each device that is connected to the system. This initial enumeration can be set to an asynchronous or synchronous enumeration. A synchronous enumeration will call all initial callbacks before IGameInput::RegisterDeviceCallback returns. The following C++ sample demonstrates how to explicitly enumerate connected gamepads and keyboards.
The following C++ sample demonstrates how to be notified when a device is connected or disconnected.

Requirements

Input API Overview
IGameInput
IGameInput::UnregisterCallback
IGameInput::StopCallback

Version History

Last modified on August 4, 2026