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

# XGameProtocolRegisterForActivation (deprecated)

> XGameProtocolRegisterForActivation (deprecated)

# XGameProtocolRegisterForActivation (deprecated)

<Info>此 API 现已弃用。请改用 [XGameActivationRegisterForEvent](/reference/system/xgameactivation/functions/xgameactivationregisterforevent)。</Info>

为协议激活注册回调。

## Syntax

```cpp theme={null}
STDAPI XGameProtocolRegisterForActivation(
    _In_opt_ XTaskQueueHandle queue,
    _In_opt_ void* context,
    _In_ XGameProtocolActivationCallback * callback,
    _Out_ XTaskQueueRegistrationToken* token
    ) noexcept;
```

### Parameters

*queue*   \_In\_opt\_\
类型：XTaskQueueHandle

用于调度事件回调的任务队列。

*context*   \_In\_opt\_\
类型：void\*

传递给事件回调的上下文。

*callback*   \_In\_\
类型：XGameProtocolActivationCallback\*

事件回调函数。

*token*   \_Out\_\
类型：[XTaskQueueRegistrationToken\*](/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken)

来自任务队列的令牌，表示此次注册。使用该令牌取消注册协议激活的回调。

### Return value

类型：HRESULT

HRESULT 成功或错误代码。
有关错误代码的列表，请参阅[错误代码](/reference/errorcodes)。

## Remarks

<Note>此函数在时间敏感型线程上调用是不安全的。有关详细</Note>
信息，请参阅[时间敏感型线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。

**XGameProtocolRegisterForActivation** 函数使用
[XGameProtocolActivationCallback](/reference/system/xgameprotocol/functions/xgameprotocolactivationcallback) 作为参数。

若要取消注册游戏邀请事件的回调，请调用 [XGameProtocolUnregisterForEvent](/reference/system/xgameprotocol/functions/xgameprotocolunregisterforactivation)。

## Requirements

**头文件：** XGameProtocol.h

**库：** xgameruntime.lib

**受支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## See also

[XGameProtocol members](/reference/system/xgameprotocol/xgameprotocol_members)


## Related topics

- [XGameProtocolActivationCallbackXGameProtocol (deprecated)](/zh-CN/reference/system/xgameprotocol/functions/xgameprotocolactivationcallback.md)
- [XGameProtocolUnregisterForActivation (deprecated)](/zh-CN/reference/system/xgameprotocol/functions/xgameprotocolunregisterforactivation.md)
- [XGameProtocol (deprecated)](/zh-CN/reference/system/xgameprotocol/xgameprotocol_members.md)
- [XGameActivation](/zh-CN/reference/system/xgameactivation/xgameactivation_members.md)
- [XGameActivationRegisterForEvent](/zh-CN/reference/system/xgameactivation/functions/xgameactivationregisterforevent.md)
