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

# XInputGetBatteryInformation

> XInputGetBatteryInformation

# XInputGetBatteryInformation

ワイヤレス コントローラーのバッテリー タイプと充電状態を取得します。

## 構文

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

### パラメーター

*dwUserIndex*   \_In\_\
型: DWORD

デバイスに関連付けられているゲーマーのインデックス。0 ～ `XUSER_MAX_COUNT - 1` の範囲の値。

*devType*   \_In\_\
型: BYTE

クエリを行う *dwUserIndex* に関連付けられているデバイスの種類。`BATTERY_DEVTYPE_GAMEPAD` または `BATTERY_DEVTYPE_HEADSET` である必要があります。

*pBatteryInformation*   \_Out\_\
型: [XINPUT\_BATTERY\_INFORMATION](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/structs/xinput_battery_information.md)\*

バッテリー情報を受け取る [XINPUT\_BATTERY\_INFORMATION](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/structs/xinput_battery_information.md) オブジェクトへのポインター。

### 戻り値

型: DWORD

関数が成功した場合、戻り値は `ERROR_SUCCESS` です。

## 解説

*pBatteryInformation* に返される値は、バッテリーの種類とその充電状態を指定します。充電状態は、既知のバッテリー タイプを持つデバイスに対してのみ有効です。

詳細については、[XInputOnGameInput ラッパー](https://docs.xbox.com/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md#xinputWrapperSection)を参照してください。

## 要件

**ヘッダー:** XInputOnGameInput.h

**ライブラリ:** xgameruntime.lib

**対応プラットフォーム:** XBOX One ファミリー本体および XBOX Series 本体

## 関連項目

[XInput から GameInput への移植](https://docs.xbox.com/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md)\
[XInputOnGameInput](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/xinputongameinput_members.md)


## Related topics

- [XINPUT_BATTERY_INFORMATION](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/structs/xinput_battery_information.md)
- [XInputOnGameInput (API の内容)](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/xinputongameinput_members.md)
- [IGameInputDevice::GetBatteryState (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getbatterystate.md)
- [GameInputBatteryState (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/structs/gameinputbatterystate.md)
- [GameInputBatteryStatus (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/enums/gameinputbatterystatus.md)
