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

# XUserGetMaxUsers

> XUserGetMaxUsers

# XUserGetMaxUsers

检索游戏会话在当前平台上允许的最大用户数。

## 语法

```cpp theme={null}
HRESULT XUserGetMaxUsers(  
         uint32_t* maxUsers  
)  
```

### 参数

*maxUsers*   \_Out\_\
类型：uint32\_t\*

包含游戏会话在当前平台上允许的最大用户数。

### 返回值

类型：HRESULT

HRESULT 成功或错误代码。\
有关错误代码列表，请参阅[错误代码](/reference/errorcodes)。

## 注解

若要检索特定用户的用户 ID，请调用 [XUserGetId](/reference/system/xuser/functions/xusergetid)。

若要检索特定用户的状态，请调用 [XUserGetState](/reference/system/xuser/functions/xusergetstate)。

若要检索特定用户的年龄组，请调用 [XUserGetAgeGroup](/reference/system/xuser/functions/xusergetagegroup)。

若要检索多人游戏会话的最大用户数，请调用 [XblMultiplayerManagerGameSessionConstants](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagergamesessionconstants)。

## 要求

**头文件：** XUser.h

**库：** xgameruntime.lib

**支持的平台：** Windows、Steam Deck、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

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

[XUserGetId](/reference/system/xuser/functions/xusergetid)

[XUserGetState](/reference/system/xuser/functions/xusergetstate)

[XUserGetAgeGroup](/reference/system/xuser/functions/xusergetagegroup)


## Related topics

- [XUser](/zh-CN/reference/system/xuser/xuser_members.md)
- [MicrosoftGame.config Element - MaxUserQuota](/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-maxuserquota.md)
- [XUserGetDefaultAudioEndpointUtf16](/zh-CN/reference/system/xuser/functions/xusergetdefaultaudioendpointutf16.md)
- [XUserGetGamertag](/zh-CN/reference/system/xuser/functions/xusergetgamertag.md)
- [XUserGetId](/zh-CN/reference/system/xuser/functions/xusergetid.md)
