> ## 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::set_custom_user_context

> chat_user::set_custom_user_context

# chat\_user::set\_custom\_user\_context

为此用户设置应用的可选、私有、自定义指针大小的上下文值。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
void set_custom_user_context(  
    void* customUserContext  
)  
```

<a id="parametersSection" />

### 参数

*customUserContext*   \_In\_opt\_\
类型：void\*

要为 `chat_user` 对象存储的任意指针大小值。

<a id="retvalSection" />

### 返回值

类型：void

无。

<a id="remarksSection" />

## 备注

此方法为此 [chat\_user](/reference/chat/gamechat2/classes/chat_user/chat_user) 对象设置应用的可选、私有、自定义指针大小的上下文值。自定义用户上下文通常用作“快捷方式”，可简化对与用户关联的本地、应用特定内存的访问，而无需进行映射查找。使用 [chat\_user::custom\_user\_context](/reference/chat/gamechat2/classes/chat_user/methods/chat_user_custom_user_context) 方法检索 `chat_user` 对象的自定义用户上下文。

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](/reference/chat/gamechat2/classes/chat_user/chat_user)


## Related topics

- [chat_user::custom_user_context](/zh-CN/reference/chat/gamechat2/classes/chat_user/methods/chat_user_custom_user_context.md)
- [chat_user_local::set_remote_user_muted](/zh-CN/reference/chat/gamechat2/classes/chat_user/chat_user_local/methods/chat_user_local_set_remote_user_muted.md)
- [chat_user_local::set_microphone_muted](/zh-CN/reference/chat/gamechat2/classes/chat_user/chat_user_local/methods/chat_user_local_set_microphone_muted.md)
- [PartyXblChatUser::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/xblreference/classes/PartyXblChatUser/methods/partyxblchatuser_setcustomcontext.md)
- [chat_user_local::set_communication_relationship](/zh-CN/reference/chat/gamechat2/classes/chat_user/chat_user_local/methods/chat_user_local_set_communication_relationship.md)
