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

# XGameInviteRegisterForEvent (deprecated)

> XGameInviteRegisterForEvent (deprecated)

# XGameInviteRegisterForEvent (deprecated)

<Info>This API is now deprecated. Use [XGameActivationRegisterForEvent](/reference/system/xgameactivation/functions/xgameactivationregisterforevent) instead.</Info>

Registers a callback for a game invite event.

## Syntax

```cpp theme={null}
HRESULT XGameInviteRegisterForEvent(  
         XTaskQueueHandle queue,  
         void* context,  
         XGameInviteEventCallback* callback,  
         XTaskQueueRegistrationToken* token  
)  
```

### Parameters

*queue*   \_In\_opt\_\
Type: XTaskQueueHandle

The task queue that dispatches the event callback.

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

The context we pass to the event callback.

*callback*   \_In\_\
Type: XGameInviteEventCallback\*

The event callback function.

*token*   \_Out\_\
Type: [XTaskQueueRegistrationToken\*](/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken)

A token from the task queue that represents the registration. Use the token to unregister the callback for the game invite event.

### Return value

Type: HRESULT

HRESULT success or error code.\
For a list of error codes, see [Error Codes](/reference/errorcodes).

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

The **XGameInviteRegisterForEvent** function uses an [XGameInviteEventCallBack](/reference/system/xgameinvite/functions/xgameinviteeventcallback) as an argument.

To unregister a callback for a game invite event, call [XGameInviteUnregisterForEvent](/reference/system/xgameinvite/functions/xgameinviteunregisterforevent).

For an example of calling this function, see the remarks section of the [XGameInviteEventCallback](/reference/system/xgameinvite/functions/xgameinviteeventcallback#ID_XGameInviteEventCallback_Remarks) topic.

## Requirements

**Header:** XGameInvite.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XGameInvite](/reference/system/xgameinvite/xgameinvite_members)

[XGameInviteEventCallBack](/reference/system/xgameinvite/functions/xgameinviteeventcallback)

[XGameInviteUnregisterForEvent](/reference/system/xgameinvite/functions/xgameinviteunregisterforevent)


## Related topics

- [XGameInviteEventCallback (deprecated)](/reference/system/xgameinvite/functions/xgameinviteeventcallback.md)
- [XGameInviteUnregisterForEvent (deprecated)](/reference/system/xgameinvite/functions/xgameinviteunregisterforevent.md)
- [XGameInvite (deprecated)](/reference/system/xgameinvite/xgameinvite_members.md)
- [Receiving invites](/services/xbox-services/multiplayer/invites/how-to/live-invites-receive.md)
- [XGameProtocolUnregisterForActivation (deprecated)](/reference/system/xgameprotocol/functions/xgameprotocolunregisterforactivation.md)
