XInputGetBatteryInformation
Retrieves the battery type and charge status of a wireless controller.
Syntax
DWORD XInputGetBatteryInformation(
DWORD dwUserIndex,
BYTE devType,
XINPUT_BATTERY_INFORMATION* pBatteryInformation
)
Parameters
dwUserIndex _In_
Type: DWORD
Index of the gamer associated with the device; a value in the range of 0 to XUSER_MAX_COUNT - 1
.
devType _In_
Type: BYTE
The type of device associated with dwUserIndex to query. Must be BATTERY_DEVTYPE_GAMEPAD
or BATTERY_DEVTYPE_HEADSET
.
pBatteryInformation _Out_
Type: XINPUT_BATTERY_INFORMATION*
Pointer to an XINPUT_BATTERY_INFORMATION object that receives the battery information.
Return value
Type: DWORD
If the function succeeds, the return value is ERROR_SUCCESS
.
Remarks
The values returned in pBatteryInformation specify the type of battery and the state of its charge. The charge state is valid only for a device that has a known battery type.
For more information, see The XInputOnGameInput wrapper.
Requirements
Header: XInputOnGameInput.h
Library: xgameruntime.lib
Supported platforms: Xbox One family consoles and Xbox Series consoles