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

# PFMatchmakingTicketSetCustomContext

> 将可选的指针大小自定义上下文值附加到 PlayFab 多人游戏匹配票证上，以供应用程序稍后检索。

在此票证对象上配置可选的自定义指针大小上下文值。

## 语法

```cpp theme={null}
HRESULT PFMatchmakingTicketSetCustomContext(  
    PFMatchmakingTicketHandle ticket,  
    void* customContext  
)  
```

### 参数

**`ticket`**   PFMatchmakingTicketHandle

匹配票证的句柄。

**`customContext`**   void\*\
*optional*

要与玩家对象一同存储的任意指针大小值。

### 返回值

类型：HRESULT

如果成功配置自定义上下文，则为 `S_OK`；否则为错误代码。可以通过 [PFMultiplayerGetErrorMessage()](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage) 获取错误代码的人类可读形式。

## 备注

自定义上下文通常用作"快捷方式"，可简化对与匹配票证关联的本地 title 特定内存的访问，而无需进行映射查找。该值可以使用 [PFMatchmakingTicketGetCustomContext()](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext) 方法检索。<br /><br /> 库将任何已配置的值视为不透明，且仅在本地设备上有效；不会通过网络传输。

## 要求

**头文件：** PFMatchmaking.h

## 另请参阅

[PFMatchmaking 成员](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members)\
[PFMatchmakingTicketGetCustomContext](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext)


## Related topics

- [PFMatchmakingTicketGetCustomContext](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext.md)
- [PlayFab Multiplayer C++ SDK 发行说明](/zh-CN/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [PFMultiplayer C/C++ API 概述 - PFMatchmaking.h](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)
- [XblMatchmakingCreateMatchTicketAsync](/zh-CN/reference/live/xsapi-c/matchmaking_c/functions/xblmatchmakingcreatematchticketasync.md)
- [XblMatchmakingDeleteMatchTicketAsync](/zh-CN/reference/live/xsapi-c/matchmaking_c/functions/xblmatchmakingdeletematchticketasync.md)
