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

# XblMultiplayerManagerLeaveGame

> XblMultiplayerManagerLeaveGame

# XblMultiplayerManagerLeaveGame

Leaves the game session, returning the XBOX user and all other local users to the lobby session.

## Syntax

```cpp theme={null}
HRESULT XblMultiplayerManagerLeaveGame(  
)  
```

### Parameters

### Return value

Type: HRESULT

HRESULT return code for this API operation.

## Remarks

This function removes the XBOX user from the game session and returns the user back to the lobby session. The game session is set to null, and all local users are also removed from the game session and returned to the lobby session. Any matchmaking request in progress is canceled when this function is called. <br />The result of this function is delivered as a multiplayer event with an event type set to `XblMultiplayerEventType::LeaveGameCompleted`. You can call [XblMultiplayerManagerDoWork](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerdowork) to retrieve multiplayer events.  <br />After leaving, you can join a different game by calling either [XblMultiplayerManagerJoinGame](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoingame) or [XblMultiplayerManagerJoinGameFromLobby](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoingamefromlobby).

## Requirements

**Header:** multiplayer\_manager\_c.h

**Library:** Microsoft.Xbox.Services.14x.GDK.C.lib

## See also

[multiplayer\_manager\_c](/reference/live/xsapi-c/multiplayer_manager_c/multiplayer_manager_c_members)\
[XblMultiplayerManagerJoinGame](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoingame)\
[XblMultiplayerManagerJoinLobby](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoinlobby)


## Related topics

- [Multiplayer Manager API overview](/services/xbox-services/multiplayer/mpm/concepts/live-multiplayer-manager-api-overview.md)
- [XblMultiplayerEventType](/reference/live/xsapi-c/multiplayer_manager_c/enums/xblmultiplayereventtype.md)
- [XblMultiplayerManagerJoinGame](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoingame.md)
- [XblMultiplayerManagerJoinGameFromLobby](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerjoingamefromlobby.md)
- [XblMultiplayerManagerGameSessionHost](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagergamesessionhost.md)
