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

# PFLobbySetCustomContext

> PFLobbySetCustomContext reference for attaching an app-defined pointer context value to a PlayFab lobby handle using the PlayFab Multiplayer C++ SDK APIs.

Configures an optional, custom pointer-sized context value with this lobby object.

## Syntax

```cpp theme={null}
HRESULT PFLobbySetCustomContext(  
    PFLobbyHandle lobby,  
    void* customContext  
)  
```

### Parameters

**`lobby`**   PFLobbyHandle

The handle of the lobby.

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

An arbitrary, pointer-sized value to store with the player object.

### Return value

Type: HRESULT

`S_OK` if configuring the custom context succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [PFMultiplayerGetErrorMessage()](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage.md).

## Remarks

The custom context is typically used as a "shortcut" that simplifies accessing local, title-specific memory associated with the lobby without requiring a mapping lookup. The value is retrieved using the [PFLobbyGetCustomContext()](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetcustomcontext.md) method. \
\
&#x20;Any configured value is treated as opaque by the library, and is only valid on the local device; it is not transmitted over the network.

## Requirements

**Header:** PFLobby.h

## See also

[PFLobby members](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members.md)\
[PFLobbyGetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetcustomcontext.md)


## Related topics

- [PFLobbyGetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetcustomcontext.md)
- [PFMultiplayer C/C++ API overview - PFLobby.h](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members.md)
- [PFMatchmakingTicketSetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketsetcustomcontext.md)
- [set_custom_user_context](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/methods/chat_user_set_custom_user_context.md)
- [PartyDevice::SetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyDevice/methods/partydevice_setcustomcontext.md)
