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

# XInputGetCapabilities

> XInputGetCapabilities

# XInputGetCapabilities

擷取已連接控制器的功能和特性。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
DWORD XInputGetCapabilities(  
         DWORD dwUserIndex,  
         DWORD dwFlags,  
         XINPUT_CAPABILITIES * pCapabilities  
)  
```

<a id="parametersSection" />

### 參數

*dwUserIndex*   \_In\_\
類型：DWORD

與裝置相關聯之玩家的索引；值的範圍為 0 到 `XUSER_MAX_COUNT - 1`。

*dwFlags*   \_In\_\
類型：DWORD

識別控制器類型的輸入旗標。如果此值為 0，則會傳回連接至系統之所有控制器的功能。目前僅支援 `XINPUT_FLAG_GAMEPAD`。

*pCapabilities*   \_Out\_\
類型：[XINPUT\_CAPABILITIES](/zh-TW/reference/input/xinputongameinput/structs/xinput_capabilities)\*

指向接收控制器功能之 [XINPUT\_CAPABILITIES](/zh-TW/reference/input/xinputongameinput/structs/xinput_capabilities) 物件的指標。

<a id="retvalSection" />

### 傳回值

類型：DWORD

如果函式成功，傳回值為 `ERROR_SUCCESS`。

如果控制器未連接，傳回值為 `ERROR_DEVICE_NOT_CONNECTED`。

如果函式失敗，傳回值為 WinError.h 中定義的錯誤碼。此函式不會使用 `SetLastError` 來設定呼叫執行緒的最後錯誤碼。

<a id="remarksSection" />

## 備註

<Note>舊版 XINPUT 9.1.0 (包含於 Windows Vista 及更新版本) 無論連接的裝置為何，一律傳回一組固定的功能。</Note>

如需所回報功能的詳細資料，請參閱 [XINPUT\_CAPABILITIES](/zh-TW/reference/input/xinputongameinput/structs/xinput_capabilities)。

如需詳細資訊，請參閱 [XInputOnGameInput 包裝函式](/zh-TW/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](/zh-TW/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/zh-TW/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XInputGetCapabilities](/reference/input/xinputongameinput/functions/xinputgetcapabilities.md)
- [XINPUT_CAPABILITIES](/reference/input/xinputongameinput/structs/xinput_capabilities.md)
