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

# XUserFindControllerForUserWithUiAsync

> XUserFindControllerForUserWithUiAsync

# XUserFindControllerForUserWithUiAsync

顯示對話方塊，提示使用者開啟並識別他們
想要使用的控制器。

## 語法

```cpp theme={null}
HRESULT XUserFindControllerForUserWithUiAsync(  
         XUserHandle user,  
         XAsyncBlock* async  
)  
```

### 參數

*user*   \_In\_\
類型：XUserHandle

要為其尋找控制器之使用者的 XUserHandle。

*async*   \_In\_\
類型：XAsyncBlock\*

用於輪詢呼叫狀態及擷取呼叫結果的 XAsyncBlock。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。如需錯誤碼清單，請參閱
[錯誤碼](/zh-TW/reference/errorcodes)。

### 備註

在桌面上，此函式不會顯示 UI。

若要取得使用者所選取控制器的結果，有幾種選擇。

1. 呼叫 [XUserFindControllerForUserWithUiResult](/zh-TW/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiresult)。
   這會傳回目前已繫結之控制器的裝置識別碼。
2. 從使用者選取新控制器時發生的 [XUserDeviceAssociationChangedCallback](/zh-TW/reference/system/xuser/functions/xuserdeviceassociationchangedcallback)
   回呼取得結果。

## 需求

**標頭：** XUser.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[XUser](/zh-TW/reference/system/xuser/xuser_members)\
[處理控制器遺失 (NDA 主題)](/zh-TW/build/core-features/common/user/users-dealing-with-controller-loss)


## Related topics

- [XUserFindControllerForUserWithUiAsync](/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiasync.md)
- [XUserFindControllerForUserWithUiResult](/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiresult.md)
- [Dealing with Controller Loss](/build/core-features/common/user/users-dealing-with-controller-loss.md)
- [When do user-to-controller associations take place?](/build/core-features/common/user/users-timing-of-user-to-device-association.md)
- [컨트롤러 손실 처리](/ko/build/core-features/common/user/users-dealing-with-controller-loss.md)
