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

# XGameInviteEventCallback (déprécié)

> XGameInviteEventCallback (déprécié)

# XGameInviteEventCallback (déprécié)

<Info>Cette API est maintenant dépréciée. Utilisez plutôt [XGameActivationCallback](/fr-CA/reference/system/xgameactivation/functions/xgameactivationcallback).</Info>

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](/fr-CA/reference/system/xgameinvite/functions/xgameinviteregisterforevent).

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

URI permettant de rejoindre la session de jeu.\
<Note>XSAPI sait comment utiliser cet URI.</Note>

### Valeur de retour

Type : void

<a id="ID_XGameInviteEventCallback_Remarks" />

## Remarques

Pour inscrire un rappel pour un événement d'invitation de jeu, appelez [XGameInviteRegisterForEvent](/fr-CA/reference/system/xgameinvite/functions/xgameinviteregisterforevent). 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](/fr-CA/reference/system/xgameinvite/functions/xgameinviteunregisterforevent).

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](/fr-CA/reference/system/xgameinvite/xgameinvite_members)

[XGameInviteRegisterForEvent](/fr-CA/reference/system/xgameinvite/functions/xgameinviteregisterforevent)

[XGameInviteUnregisterForEvent](/fr-CA/reference/system/xgameinvite/functions/xgameinviteunregisterforevent)


## Related topics

- [XGameInviteEventCallback (deprecated)](/zh-CN/reference/system/xgameinvite/functions/xgameinviteeventcallback.md)
- [XGameInviteEventCallback (en desuso)](/es/reference/system/xgameinvite/functions/xgameinviteeventcallback.md)
- [XGameInviteUnregisterForEvent (deprecated)](/reference/system/xgameinvite/functions/xgameinviteunregisterforevent.md)
- [XGameInviteRegisterForEvent (deprecated)](/reference/system/xgameinvite/functions/xgameinviteregisterforevent.md)
- [XGameInvite (deprecated)](/reference/system/xgameinvite/xgameinvite_members.md)
