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

# PairControllerWithUserId

> IXtfUserClient::PairControllerWithUserId 方法

# IXtfUserClient::PairControllerWithUserId 方法

將由指定使用者識別碼識別的使用者與具有指定控制器識別碼的控制器配對。

## 語法

```cpp theme={null}
public:
HRESULT PairControllerWithUserId(
         UINT32 userId,
         UINT64 controllerId
)  
```

### 參數

*userId*\
類型：UINT32

要與控制器配對之使用者的使用者識別碼。

*controllerId*\
類型：UINT64

控制器的控制器識別碼。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

## 備註

若要取得使用者的使用者識別碼，請呼叫 [ListUsers](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/listusers-ixtfuserclient-xtfuser-xbox-windows-m.md)。在傳回的 [XTF\_USER\_DATA](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfuser/structures/XTF_USER_DATA-xtfuser-xbox-windows-t.md) 結構中，檢查 *userId* 成員。

使用 **PairControllerWithUserId** 配對控制器是累加的。如果已有使用者與控制器配對，*userName* 所指定的使用者也會與該控制器配對。若要建立獨佔配對，請呼叫 **PairControllerWithUserIdExclusive** 或 **PairControllerWithUserExclusive**。

## 需求

**標頭：** xtfuser.h

**程式庫：** xtfuser.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

## 另請參閱

[PairControllerWithUser](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/paircontrollerwithuser-ixtfuserclient-xtfuser-xbox-windows-m.md)


## Related topics

- [PairControllerWithUser](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/paircontrollerwithuser-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient 介面 (介面內容)](https://docs.xbox.com/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/ixtfuserclient-xtfuser-xbox-windows-t.md)
- [XUserFindControllerForUserWithUiResult](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiresult.md)
- [XUserFindControllerForUserWithUiAsync](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiasync.md)
- [PFAccountManagementSteamPlayFabIdPair](https://docs.xbox.com/zh-TW/services/playfab/api-references/c/pfaccountmanagementtypes/structs/pfaccountmanagementsteamplayfabidpair.md)
