> ## 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

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

<a id="syntaxSection" />

## 構文

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

<a id="parametersSection" />

### パラメーター

*dwUserIndex*   \_In\_\
型: DWORD

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

*devType*   \_In\_\
型: BYTE

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

*pBatteryInformation*   \_Out\_\
型: [XINPUT\_BATTERY\_INFORMATION](/reference/input/xinputongameinput/structs/xinput_battery_information)\*

バッテリー情報を受け取る [XINPUT\_BATTERY\_INFORMATION](/reference/input/xinputongameinput/structs/xinput_battery_information) オブジェクトへのポインター。

<a id="retvalSection" />

### 戻り値

型: DWORD

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

<a id="remarksSection" />

## 解説

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

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

<a id="requirementsSection" />

## 要件

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

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

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

<a id="seealsoSection" />

## 関連項目

[XInput から GameInput への移植](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

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