XInputGetBatteryInformation function (xinput.h)

Retrieves the battery type and charge status of a wireless controller.


DWORD XInputGetBatteryInformation(
  [in]  DWORD                      dwUserIndex,
  [in]  BYTE                       devType,
  [out] XINPUT_BATTERY_INFORMATION *pBatteryInformation


[in] dwUserIndex

Index of the signed-in gamer associated with the device. Can be a value in the range 0–XUSER_MAX_COUNT − 1.

[in] devType

Specifies which device associated with this user index should be queried. Must be BATTERY_DEVTYPE_GAMEPAD or BATTERY_DEVTYPE_HEADSET.

[out] pBatteryInformation

Pointer to an XINPUT_BATTERY_INFORMATION structure that receives the battery information.

Return value

If the function succeeds, the return value is ERROR_SUCCESS.


Requirement Value
Target Platform Windows
Header xinput.h
Library Xinput.lib
DLL Xinput1_4.dll

See also

XInput Functions