Skip to main content
Retrieves information about the generic controller switches, such as hat switches and directional pads, on the device.

Syntax

Parameters

infoArrayCount   _In_
Type: uint32_t
Number of elements in infoArray. To retrieve all controller switches, pass the value returned by GetControllerSwitchCount. infoArray   _Out_writes_to_opt_(infoArrayCount, return)
Type: GameInputControllerSwitchInfo*
Pointer to an array that receives one structure per controller switch. Can be nullptr, in which case nothing is written and the method returns 0.

Return value

Type: uint32_t The number of elements written to infoArray. This is the smaller of infoArrayCount and the number of controller switches on the device, or 0 if infoArray is nullptr or the device has no controller switches.

Remarks

Each element is a GameInputControllerSwitchInfo structure that describes the kind of the corresponding switch (2-way, 4-way, or 8-way, as a GameInputSwitchKind value) and the label of each of its positions. Call GetControllerSwitchCount to get the number of controller switches, allocate an array of that size, and then call GetControllerSwitchInfo to fill it. If infoArrayCount is smaller than the number of controller switches, only the first infoArrayCount elements are written. The controller switches of a device don’t change while the device is connected, so you can query them once and cache the result. Element i of the info array describes the switch at index i of the array returned by IGameInputReading::GetControllerSwitchState for readings from this device. The following example shows how to retrieve the controller switches of a device.
In GameInput v3 and earlier, this information was available from the controllerSwitchInfo member of the GameInputControllerInfo structure, which was referenced by the controllerInfo member of the GameInputDeviceInfo structure returned by IGameInputDevice::GetDeviceInfo.

Requirements

Header: GameInput.h Library: gameinput.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

Overview of GameInput
GetControllerSwitchCount
GameInputControllerSwitchInfo
GameInputSwitchKind
IGameInputReading::GetControllerSwitchState
IGameInputDevice

Version History

Last modified on November 5, 2026