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

# chat_user::xbox_user_id

> chat_user::xbox_user_id

# chat\_user::xbox\_user\_id

返回此用户的唯一 XBOX 用户 ID。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
_Ret_z_ xbox_user_id(  
)  
```

<a id="parametersSection" />

### 参数

无。

<a id="retvalSection" />

### 返回值

类型：\_Ret\_z\_

返回一个指向以 null 结尾的字符串的指针，该字符串表示此用户的唯一 XBOX 用户 ID。

<a id="remarksSection" />

## 备注

此方法返回一个指向以 null 结尾的字符串的指针，该字符串表示此 [chat\_user](/reference/chat/gamechat2/classes/chat_user/chat_user) 对象的唯一 XBOX 用户 ID。返回字符串指针的内存在 `chat_user object` 的生命周期内保持有效，即直到通过调用 [chat\_manager::remove\_user](/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_remove_user) 方法移除用户为止。有关使用应用的本地 [chat\_manager](/reference/chat/gamechat2/classes/chat_manager/chat_manager) 实例管理用户的详细信息，请参阅[使用 Game Chat 2 C++ API](/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2) 中的[向 Game Chat 2 添加用户](/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2#adding_users_to_game_chat_2)部分。

<a id="requirementsSection" />

## 要求

**头文件：** GameChat2.h

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

<a id="seealsoSection" />

## 另请参阅

[Game Chat 2 简介](/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro)\
[chat\_user::custom\_user\_context](/reference/chat/gamechat2/classes/chat_user/methods/chat_user_custom_user_context)\
[chat\_user](/reference/chat/gamechat2/classes/chat_user/chat_user)
