XInputGetBatteryInformation function

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

Syntax

DWORD XInputGetBatteryInformation(
  DWORD                      dwUserIndex,
  BYTE                       devType,
  XINPUT_BATTERY_INFORMATION *pBatteryInformation
);

Parameters

dwUserIndex

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

devType

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

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.

Requirements

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

See Also

XInput Functions