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

# XGameInviteEventCallback (déprécié)

> XGameInviteEventCallback (déprécié)

# XGameInviteEventCallback (déprécié)

> [!NOTE]
>
> Cette API est maintenant dépréciée. Utilisez plutôt [XGameActivationCallback](https://docs.xbox.com/fr-CA/reference/system/xgameactivation/functions/xgameactivationcallback.md).

Rappel défini par une application pour un événement d'invitation de jeu.

## Syntaxe

```cpp theme={null}
void XGameInviteEventCallback(  
         void* context,  
         const char* inviteUri  
)  
```

### Paramètres

*context*   \_In\_opt\_\
Type : void\*

Contexte que nous passons à [XGameInviteRegisterForEvent](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/functions/xgameinviteregisterforevent.md).

*inviteUri*   \_In\_\
Type : char\*

URI permettant de rejoindre la session de jeu.\
\[!NOTE] XSAPI sait comment utiliser cet URI.

### Valeur de retour

Type : void

## Remarques

Pour inscrire un rappel pour un événement d'invitation de jeu, appelez [XGameInviteRegisterForEvent](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/functions/xgameinviteregisterforevent.md). La fonction prend comme argument un pointeur vers un **XGameInviteEventCallback**.

Pour désinscrire un rappel pour un événement d'invitation de jeu, appelez [XGameInviteUnregisterForEvent](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/functions/xgameinviteunregisterforevent.md).

L'exemple de code suivant s'inscrit à un rappel d'invitation de jeu.

```cpp theme={null}
#include <XTaskQueue.h>
#include <XGameInvite.h>  
  
XTaskQueueHandle g_taskQueue;  
XTaskQueueRegistrationToken g_gameInviteEventToken;  
  
void OnGameInvite(void* context, const char* inviteUri)  
{  
    if (inviteUri != nullptr)
    {
        std::string inviteString(inviteUri);
        auto pos = inviteString.find("handle=");
        auto inviteHandeId = inviteString.substr(pos + 7, 36);
        // Now call XblMultiplayerManagerJoinLobby if using MPM
        // or call XblMultiplayerWriteSessionByHandleAsync if using MPSD APIs
    }
}  
  
void InitializeGame()  
{  
    XGameInviteRegisterForEvent(g_taskQueue, nullptr, OnGameInvite, &g_gameInviteEventToken);  
}  
  
void ShutdownGame()  
{  
    XGameInviteUnregisterForEvent(g_gameInviteEventToken);  
}  
```

## Configuration requise

**En-tête :** XGameInvite.h

**Bibliothèque :** xgameruntime.lib

**Plateformes prises en charge :** Windows, consoles de la famille XBOX One et consoles XBOX Series

## Voir aussi

[XGameInvite](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/xgameinvite_members.md)

[XGameInviteRegisterForEvent](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/functions/xgameinviteregisterforevent.md)

[XGameInviteUnregisterForEvent](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/functions/xgameinviteunregisterforevent.md)


## Related topics

- [XGameInviteUnregisterForEvent (déprécié)](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/functions/xgameinviteunregisterforevent.md)
- [XGameInviteRegisterForEvent (déprécié)](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/functions/xgameinviteregisterforevent.md)
- [XGameInvite (déprécié)](https://docs.xbox.com/fr-CA/reference/system/xgameinvite/xgameinvite_members.md)
- [XGameActivationCallback](https://docs.xbox.com/fr-CA/reference/system/xgameactivation/functions/xgameactivationcallback.md)
- [XGameProtocolUnregisterForActivation (déprécié)](https://docs.xbox.com/fr-CA/reference/system/xgameprotocol/functions/xgameprotocolunregisterforactivation.md)
