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

# XGameActivationRegisterForEvent

> XGameActivationRegisterForEvent

# XGameActivationRegisterForEvent

アクティブ化イベントのコールバックを登録します。

## Syntax

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

### Parameters

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

イベント コールバックをディスパッチするタスク キュー。

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

イベント コールバックに渡されるコンテキスト。

*callback*   \_In\_\
型: [XGameActivationCallback](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationcallback.md)\*

イベント コールバック関数。

*token*   \_Out\_\
型: [XTaskQueueRegistrationToken\*](https://docs.xbox.com/ja-jp/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken.md)

登録を表すタスク キューからのトークン。このトークンを使用して、アクティブ化イベントのコールバックの登録を解除します。

### Return value

型: HRESULT

HRESULT の成功またはエラー コード。\
エラー コードの一覧については、[エラー コード](https://docs.xbox.com/ja-jp/reference/errorcodes.md)を参照してください。

## Remarks

> [!NOTE]
>
> この関数は、時間依存スレッドから呼び出しても安全ではありません。詳細については、[Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。

**XGameActivationRegisterForEvent** 関数は、[XGameActivationCallback](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationcallback.md) を引数として使用します。コールバックは、アクティブ化の種類と対応するデータを含む [XGameActivationInfo](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/structs/xgameactivationinfo.md) 構造体を受け取ります。

この API は、プロトコル アクティブ化、ファイル アクティブ化、およびゲーム招待を含むすべてのアクティブ化タイプを処理します。非推奨の `XGameProtocolRegisterForActivation` および `XGameInviteRegisterForEvent` API を置き換えます。

アクティブ化イベントのコールバックの登録を解除するには、[XGameActivationUnregisterForEvent](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationunregisterforevent.md) を呼び出します。

この関数の呼び出し例については、[XGameActivationCallback](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationcallback.md#remarks) トピックの「Remarks」セクションを参照してください。

## Requirements

**ヘッダー:** XGameActivation.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

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

## See also

[XGameActivation](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/xgameactivation_members.md)

[XGameActivationCallback](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationcallback.md)

[XGameActivationUnregisterForEvent](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationunregisterforevent.md)


## Related topics

- [XGameActivation (API の内容)](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/xgameactivation_members.md)
- [XGameActivationUnregisterForEvent](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationunregisterforevent.md)
- [XGameActivationCallback](https://docs.xbox.com/ja-jp/reference/system/xgameactivation/functions/xgameactivationcallback.md)
- [XGameProtocolRegisterForActivation (非推奨)](https://docs.xbox.com/ja-jp/reference/system/xgameprotocol/functions/xgameprotocolregisterforactivation.md)
- [XGameInviteRegisterForEvent (非推奨)](https://docs.xbox.com/ja-jp/reference/system/xgameinvite/functions/xgameinviteregisterforevent.md)
