> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PFMatchmakingTicketSetCustomContext

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

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

## 语法

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

### 参数

**`ticket`**   PFMatchmakingTicketHandle

匹配票证的句柄。

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

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

### 返回值

类型：HRESULT

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

## 备注

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

## 要求

**头文件：** PFMatchmaking.h

## 另请参阅

[PFMatchmaking 成员](https://docs.xbox.com/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)\
[PFMatchmakingTicketGetCustomContext](https://docs.xbox.com/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext.md)


## Related topics

- [PFMatchmakingTicketGetCustomContext](https://docs.xbox.com/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext.md)
- [PlayFab Multiplayer C++ SDK 发行说明](https://docs.xbox.com/zh-CN/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [PFMultiplayer C/C++ API 概览 - PFMatchmaking.h](https://docs.xbox.com/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)
- [Join Matchmaking Ticket](https://docs.xbox.com/api-reference/matchmaking/join-matchmaking-ticket.md)
- [Cancel Matchmaking Ticket](https://docs.xbox.com/api-reference/matchmaking/cancel-matchmaking-ticket.md)
