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

# XUserFindControllerForUserWithUiResult

> XUserFindControllerForUserWithUiResult

# XUserFindControllerForUserWithUiResult

Retrieves the application local device ID (APP\_LOCAL\_DEVICE\_ID) that a user has chosen to use.

## Syntax

```cpp theme={null}
HRESULT XUserFindControllerForUserWithUiResult(  
         XAsyncBlock* async,  
         APP_LOCAL_DEVICE_ID* deviceId  
)  
```

### Parameters

*async*   \_Inout\_\
Type: XAsyncBlock\*

The async block sent to [XUserFindControllerForUserWithUiAsync](/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiasync).

*deviceId*   \_Out\_\
Type: APP\_LOCAL\_DEVICE\_ID\*

The device ID of the controller that is now associated to the user.

### 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 always return an all-zero device ID.

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

- [XUserFindControllerForUserWithUiAsync](/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiasync.md)
- [Dealing with Controller Loss](/build/core-features/common/user/users-dealing-with-controller-loss.md)
- [XUser](/reference/system/xuser/xuser_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XUserResolveIssueWithUiResult](/reference/system/xuser/functions/xuserresolveissuewithuiresult.md)
