Compartilhar via


XUserFindUserById

Retrieves the XUserHandle based on the Xbox User ID (XUID) of a local user.

Syntax

HRESULT XUserFindUserById(  
         uint64_t userId,  
         XUserHandle* handle  
)  

Parameters

userId   _In_
Type: uint64_t

The local user to retrieve the XUID for.

handle   _Out_
Type: XUserHandle*

Contains the XUID for the local user.

Return value

Type: HRESULT

HRESULT success or error code.
For a list of error codes, see Error Codes.

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

For each XUserHandle handle that you retrieve from an XUser API, inluding XUserFindUserById, you must close that handle calling XUserCloseHandle.

To retrieve the XBox User ID (XUID) for a local user, call XUserFindUserById.

To retrieve a handle to a user for a specific local user ID, call XUserFindUserByLocalId.

To retrieve a user ID for a specific device ID, call XUserFindForDevice.

Requirements

Header: XUser.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XUser

XUserFindUserByLocalId

XUserFindForDevice