> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XInputGetBatteryInformation

> XInputGetBatteryInformation

# XInputGetBatteryInformation

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

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
DWORD XInputGetBatteryInformation(  
         DWORD dwUserIndex,  
         BYTE devType,  
         XINPUT_BATTERY_INFORMATION* pBatteryInformation  
)  
```

<a id="parametersSection" />

### 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](/reference/input/xinputongameinput/structs/xinput_battery_information)\*

Pointer to an [XINPUT\_BATTERY\_INFORMATION](/reference/input/xinputongameinput/structs/xinput_battery_information) object that receives the battery information.

<a id="retvalSection" />

### Return value

Type: DWORD

If the function succeeds, the return value is `ERROR_SUCCESS`.

<a id="remarksSection" />

## 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](/build/core-features/common/input/porting/input-porting-xinput#xinputWrapperSection).

<a id="requirementsSection" />

## Requirements

**Header:** XInputOnGameInput.h

**Library:** xgameruntime.lib

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

<a id="seealsoSection" />

## See also

[Porting from XInput to GameInput](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XINPUT_BATTERY_INFORMATION](/reference/input/xinputongameinput/structs/xinput_battery_information.md)
- [XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members.md)
- [IGameInputDevice::GetBatteryState](/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getbatterystate.md)
- [GameInputBatteryState](/reference/input/gameinput/deprecated/structs/gameinputbatterystate.md)
- [GameInputBatteryStatus](/reference/input/gameinput/deprecated/enums/gameinputbatterystatus.md)
