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

# PartyChatControl::SetCustomContext

> 为此聊天控件对象配置一个可选的、自定义指针大小的上下文值。

为此聊天控件对象配置一个可选的、自定义指针大小的上下文值。

## 语法

```cpp theme={null}
PartyError SetCustomContext(  
    void* customContext  
)  
```

### 参数

**`customContext`**   void\*
*可选*

要与聊天控件对象一起存储的任意指针大小的值。

### 返回值

PartyError

如果配置自定义上下文成功,则返回 `c_partyErrorSuccess`;否则返回错误代码。可以通过 [PartyManager::GetErrorMessage()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage) 检索错误代码的人类可读形式。

## 备注

自定义上下文通常用作“快捷方式”,简化访问与聊天控件关联的本地、标题特定的内存,而无需进行映射查找。使用 [GetCustomContext()](/services/playfab/multiplayer/networking/reference/classes/PartyChatControl/methods/partychatcontrol_getcustomcontext) 方法检索该值。<br /><br /> 库将任何已配置的值视为不透明,并且仅在本地设备上有效;它不会通过网络传输。

## 要求

\*\*头文件:\*\*Party.h

## 另请参阅

[PartyChatControl](/services/playfab/multiplayer/networking/reference/classes/PartyChatControl/partychatcontrol)
[PartyChatControl::GetCustomContext](/services/playfab/multiplayer/networking/reference/classes/PartyChatControl/methods/partychatcontrol_getcustomcontext)


## Related topics

- [PartyChatControl::GetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyChatControl/methods/partychatcontrol_getcustomcontext.md)
- [PartyXblChatUser::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/xblreference/classes/PartyXblChatUser/methods/partyxblchatuser_setcustomcontext.md)
- [PartyInvitation::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyInvitation/methods/partyinvitation_setcustomcontext.md)
- [PartyNetwork::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_setcustomcontext.md)
- [PartyDevice::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyDevice/methods/partydevice_setcustomcontext.md)
