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

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](/reference/errorcodes).

### 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](/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiresult).
   This will return the device ID of the now bound controller.
2. Get the result from the [XUserDeviceAssociationChangedCallback](/reference/system/xuser/functions/xuserdeviceassociationchangedcallback)
   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](/reference/system/xuser/xuser_members)\
[Dealing with Controller Loss (NDA topic)](/build/core-features/common/user/users-dealing-with-controller-loss)


## Related topics

- [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)
- [XR-115 Adding and removing users or controllers in play](/publishing/certification/xr/xr-115.md)
- [XR-112 Establishing a user and controller on activation](/publishing/certification/xr/xr-112.md)
