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

# XUserFindControllerForUserWithUiAsync

> XUserFindControllerForUserWithUiAsync

Shows a dialog that will prompt the user to turn on and identify which controller they
want to use.

## Syntax

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

### Parameters

*user*   \_In\_\
Type: XUserHandle

The XUserHandle of the user for which to find a controller.

*async*   \_In\_\
Type: XAsyncBlock\*

An XAsyncBlock for polling for the call's status and retrieving call results.

### Return value

Type: HRESULT

HRESULT success or error code. For a list of error codes, see
[Error Codes](https://docs.xbox.com/reference/errorcodes.md).

### Remarks

On desktop, this function will not show UI.

To get the results of what controller the user has selected, there are a couple of choices.

1. Call [XUserFindControllerForUserWithUiResult](https://docs.xbox.com/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiresult.md).
   This will return the device ID of the now bound controller.
2. Get the result from the [XUserDeviceAssociationChangedCallback](https://docs.xbox.com/reference/system/xuser/functions/xuserdeviceassociationchangedcallback.md)
   callback that will happen when the user has selected their new controller.

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[XUser](https://docs.xbox.com/reference/system/xuser/xuser_members.md)\
[Dealing with Controller Loss (NDA topic)](https://docs.xbox.com/build/core-features/common/user/users-dealing-with-controller-loss.md)


## Related topics

- [XUserFindControllerForUserWithUiResult](https://docs.xbox.com/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiresult.md)
- [Dealing with Controller Loss](https://docs.xbox.com/build/core-features/common/user/users-dealing-with-controller-loss.md)
- [When do user-to-controller associations take place?](https://docs.xbox.com/build/core-features/common/user/users-timing-of-user-to-device-association.md)
- [XR-112 Establishing a User and Controller During Initial Activation and Resume](https://docs.xbox.com/publishing/certification/xr/xr-112.md)
- [XR-115 Addition and Removal of Users or Controllers During Gameplay](https://docs.xbox.com/publishing/certification/xr/xr-115.md)
