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

# PFMultiplayerJoinLobby

> PFMultiplayerJoinLobby 参考，用于在 Multiplayer C++ SDK 中使用连接字符串以本地 PlayFab 实体身份加入现有 PlayFab 大厅。

以本地 PlayFab 实体身份加入大厅。

## 语法

```cpp theme={null}
HRESULT PFMultiplayerJoinLobby(  
    PFMultiplayerHandle handle,  
    const PFEntityKey* newMember,  
    const char* connectionString,  
    const PFLobbyJoinConfiguration* configuration,  
    void* asyncContext,  
    PFLobbyHandle* lobby  
)  
```

### 参数

**`handle`**   PFMultiplayerHandle

PFMultiplayer API 实例的句柄。

**`newMember`**   [PFEntityKey\*](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/pfentitykey_clientsdk)

加入大厅的本地实体。

**`connectionString`**   char\*\
*is null-terminated*

该实体用于加入大厅的连接字符串。

**`configuration`**   [PFLobbyJoinConfiguration\*](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinconfiguration)

加入大厅时使用的初始配置数据。

**`asyncContext`**   void\*\
*optional*

一个可选的、应用定义的、指针大小的上下文值，可用于将完成状态更改与此调用相关联。

**`lobby`**   PFLobbyHandle\*\
*optional, library-allocated output*

可选的输出大厅对象，可用于在此操作完成后立即排队执行操作。

### 返回值

类型：HRESULT

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

## 备注

这是一个异步操作。成功完成后，将向标题依次提供一个 [PFLobbyMemberAddedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbymemberaddedstatechange)、一个 [PFLobbyUpdatedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyupdatedstatechange) 以及一个 [PFLobbyJoinLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange)，其中 [PFLobbyJoinLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange) 字段设置为 `S_OK`。完成失败时，将向标题提供一个 [PFLobbyJoinLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange)，其中 [PFLobbyJoinLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange) 字段设置为失败。

## 要求

**头文件：** PFLobby.h

## 另请参阅

[PFLobby 成员](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members)


## Related topics

- [PFLobbyGetLobbyProperty](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbyproperty.md)
- [PFLobbyGetLobbyPropertyKeys](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbypropertykeys.md)
- [PFLobbyGetMembers](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetmembers.md)
- [PFLobbyGetMemberProperty](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetmemberproperty.md)
- [PFLobbyGetMemberPropertyKeys](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetmemberpropertykeys.md)
