XUserSignOutAsync
Asynchronously signs out a user on runtimes where the game manages sign-out, such as Steam Deck.Syntax
Parameters
user   _In_Type: XUserHandle A handle to the user to sign out. async   _Inout_
Type: XAsyncBlock* An XAsyncBlock for polling for the call’s status and retrieving call results.
Return value
Type: HRESULT HRESULT success or error code. A success code means that the sign-out operation started, not that it finished. Call XUserSignOutResult to get the result of the operation.
For a list of error codes, see Error codes.
Remarks
XUserSignOutAsync starts an asynchronous operation that signs out user. Call XUserSignOutResult in the completion callback of async to get the result. Call XUserIsSignOutPresent first, and call XUserSignOutAsync only when it returnstrue. When XUserIsSignOutPresent returns false, sign-out isn’t available through this API in the current runtime.
When the user transitions to signed out, callbacks that you registered with XUserRegisterForChangeEvent receive the SigningOut and SignedOut XUserChangeEvent notifications. These notifications report an actual state transition. They aren’t guaranteed for every call to XUserSignOutAsync, for example when the user is already signed out.
A failed or canceled operation doesn’t tell you the user’s current state. Handle and report the result code, and use XUserGetState and user change events to decide how your game treats the user afterward. A canceled operation returns E_ABORT from XUserSignOutResult.
Close each user handle that you acquire just once, when you no longer need it, by calling XUserCloseHandle. You can keep a handle after the user signs out. If the same user signs in again, your change event callback receives XUserChangeEvent::SignedInAgain for that user.
The following example signs out a user. It requires XUser.h, XAsync.h, and <memory>. It assumes that the game created queue by calling XTaskQueueCreate and dispatches the queue’s completion port so that the completion callback runs.
