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

# XGameActivationRegisterForEvent

> XGameActivationRegisterForEvent

# XGameActivationRegisterForEvent

Registers a callback for activation events.

## Syntax

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

### Parameters

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

The task queue that dispatches the event callback.

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

The context passed to the event callback.

*callback*   \_In\_\
Type: [XGameActivationCallback](/reference/system/xgameactivation/functions/xgameactivationcallback)\*

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 activation events.

### 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 **XGameActivationRegisterForEvent** function uses an [XGameActivationCallback](/reference/system/xgameactivation/functions/xgameactivationcallback) as an argument. The callback receives an [XGameActivationInfo](/reference/system/xgameactivation/structs/xgameactivationinfo) structure that contains the activation type and corresponding data.

This API handles all activation types including protocol activation, file activation, and game invites. It replaces the deprecated `XGameProtocolRegisterForActivation` and `XGameInviteRegisterForEvent` APIs.

To unregister a callback for activation events, call [XGameActivationUnregisterForEvent](/reference/system/xgameactivation/functions/xgameactivationunregisterforevent).

For an example of calling this function, see the remarks section of the [XGameActivationCallback](/reference/system/xgameactivation/functions/xgameactivationcallback#remarks) topic.

## Requirements

**Header:** XGameActivation.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [File type activation](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/overviews/filetypeactivation)
* [Receiving invites](/services/xbox-services/multiplayer/invites/how-to/live-invites-receive)

## See also

[XGameActivation](/reference/system/xgameactivation/xgameactivation_members)

[XGameActivationCallback](/reference/system/xgameactivation/functions/xgameactivationcallback)

[XGameActivationUnregisterForEvent](/reference/system/xgameactivation/functions/xgameactivationunregisterforevent)


## Related topics

- [XGameActivation](/reference/system/xgameactivation/xgameactivation_members.md)
- [XGameActivationUnregisterForEvent](/reference/system/xgameactivation/functions/xgameactivationunregisterforevent.md)
- [XGameProtocolRegisterForActivation (deprecated)](/reference/system/xgameprotocol/functions/xgameprotocolregisterforactivation.md)
- [Receiving invites](/services/xbox-services/multiplayer/invites/how-to/live-invites-receive.md)
- [XGameActivationCallback](/reference/system/xgameactivation/functions/xgameactivationcallback.md)
