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

# XblMultiplayerSessionSetLocked

> XblMultiplayerSessionSetLocked

# XblMultiplayerSessionSetLocked

设置会话是否被锁定。如果被锁定，离开会话的成员将能够重新加入会话，而不允许其他用户占用其位置。

## 语法

```cpp theme={null}
void XblMultiplayerSessionSetLocked(  
         XblMultiplayerSessionHandle handle,  
         bool locked  
)  
```

### 参数

*handle*   \_In\_\
类型：[XblMultiplayerSessionHandle](/reference/live/xsapi-c/multiplayer_c/handles/xblmultiplayersessionhandle)

多人游戏会话的句柄。

*locked*   \_In\_\
类型：bool

如果应锁定会话，则设置为 true；否则设置为 false。

### 返回值

类型：void

## 备注

如果会话被锁定，则还必须将其设置为已关闭。

## 要求

**头文件：** multiplayer\_c.h

**库：** Microsoft.Xbox.Services.14x.GDK.C.lib

## 另请参阅

[multiplayer\_c](/reference/live/xsapi-c/multiplayer_c/multiplayer_c_members)


## Related topics

- [XblMultiplayerSessionSetSessionChangeSubscription](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionsetsessionchangesubscription.md)
- [XblMultiplayerSessionSetClosed](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionsetclosed.md)
- [XblMultiplayerSessionConstantsSetMaxMembersInSession](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionconstantssetmaxmembersinsession.md)
- [XblMultiplayerSessionSetMatchmakingTargetSessionConstantsJson](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionsetmatchmakingtargetsessionconstantsjson.md)
- [XblMultiplayerSessionConstantsSetCapabilities](/zh-CN/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersessionconstantssetcapabilities.md)
