> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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\*](https://docs.xbox.com/reference/system/xuser/enums/xuserstate.md)

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](https://docs.xbox.com/reference/errorcodes.md).

## Remarks

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

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

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

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

## See also

[XUser](https://docs.xbox.com/reference/system/xuser/xuser_members.md)

[XUserState](https://docs.xbox.com/reference/system/xuser/enums/xuserstate.md)

[XUserRegisterForChangeEvent](https://docs.xbox.com/reference/system/xuser/functions/xuserregisterforchangeevent.md)

[XUserChangeEvent](https://docs.xbox.com/reference/system/xuser/enums/xuserchangeevent.md)


## Related topics

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