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

# XUserGetState

> XUserGetState

# XUserGetState

Retrieves the state of a user.

## Syntax

```cpp theme={null}
HRESULT XUserGetState(  
         XUserHandle user,  
         XUserState* state  
)  
```

### Parameters

*user*   \_In\_\
Type: XUserHandle

A handle to the user to retrieve the state for.

*state*   \_Out\_\
Type: [XUserState\*](/reference/system/xuser/enums/xuserstate)

Contains the state of a specific user.

### Return value

Type: HRESULT

HRESULT success or error code.\
For a list of error codes, see [Error Codes](/reference/errorcodes).

## Remarks

A user can exist in three states within a game title. For details, visit [XUserState](/reference/system/xuser/enums/xuserstate).

To monitor changes to a user's state or information, call the [XUserRegisterForChangeEvent](/reference/system/xuser/functions/xuserregisterforchangeevent) function. The function subscribes to an [XUserChangeEvent](/reference/system/xuser/enums/xuserchangeevent) enumeration.

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

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

## See also

[XUser](/reference/system/xuser/xuser_members)

[XUserState](/reference/system/xuser/enums/xuserstate)

[XUserRegisterForChangeEvent](/reference/system/xuser/functions/xuserregisterforchangeevent)

[XUserChangeEvent](/reference/system/xuser/enums/xuserchangeevent)


## Related topics

- [XUserState](/reference/system/xuser/enums/xuserstate.md)
- [XUserGetMaxUsers](/reference/system/xuser/functions/xusergetmaxusers.md)
- [XUserGetGamertag](/reference/system/xuser/functions/xusergetgamertag.md)
- [XUserGetLocalId](/reference/system/xuser/functions/xusergetlocalid.md)
- [User identity and XUser](/build/core-features/common/user/player-identity-xuser.md)
