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

# PFMatchmakingTicketCancel

> 取消正在进行的 PlayFab 多人游戏匹配票证，停止匹配搜索并将票证过渡到已取消状态。

取消票证。

## 语法

```cpp theme={null}
HRESULT PFMatchmakingTicketCancel(  
    PFMatchmakingTicketHandle ticket  
)  
```

### 参数

**`ticket`**   PFMatchmakingTicketHandle

匹配票证的句柄。

### 返回值

类型：HRESULT

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

## 备注

此方法将异步操作加入队列以取消此匹配票证。成功时，将提供 [PFMatchmakingTicketCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/structs/pfmatchmakingticketcompletedstatechange) 以指示票证已取消。<br /><br /> 此方法不保证票证一定会被取消。票证可能在取消处理前完成，或者由于网络或服务错误，取消请求可能失败。如果取消尝试失败但可重试，库将继续重试取消。否则，将提供 [PFMatchmakingTicketCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/structs/pfmatchmakingticketcompletedstatechange) 以指示票证失败。

## 要求

**头文件：** PFMatchmaking.h

## 另请参阅

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


## Related topics

- [Matchmaking SDK 快速入门](/zh-CN/services/playfab/multiplayer/matchmaking/quickstart-client-sdk.md)
- [使用服务器回填工单 - Multiplayer SDK](/zh-CN/services/playfab/multiplayer/matchmaking/backfill-tickets-multiplayer-sdk.md)
- [PFMultiplayer C/C++ API 概述 - PFMatchmaking.h](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)
- [PlayFab Multiplayer C++ SDK 发行说明](/zh-CN/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [MatchmakingTicket.Cancel](/zh-CN/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/Cancel.md)
