> ## 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 (已淘汰)

> XGameProtocolRegisterForActivation (已淘汰)

# XGameProtocolRegisterForActivation (已淘汰)

<Info>此 API 現已淘汰。請改用 [XGameActivationRegisterForEvent](/zh-TW/reference/system/xgameactivation/functions/xgameactivationregisterforevent)。</Info>

註冊通訊協定啟用的回呼。

## 語法

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

### 參數

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

分派事件回呼的工作佇列。

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

我們傳遞給事件回呼的內容。

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

事件回呼函式。

*token*   \_Out\_\
類型：[XTaskQueueRegistrationToken\*](/zh-TW/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken)

來自工作佇列、代表此註冊的權杖。使用此權杖可取消註冊
通訊協定啟用的回呼。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。\
如需錯誤碼清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

## 備註

<Note>在時間敏感的執行緒上呼叫此函式並不安全。如需</Note>
詳細資訊，請參閱[時間敏感的執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。

**XGameProtocolRegisterForActivation** 函式會使用
[XGameProtocolActivationCallback](/zh-TW/reference/system/xgameprotocol/functions/xgameprotocolactivationcallback) 作為引數。

若要取消註冊遊戲
邀請事件的回呼，請呼叫 [XGameProtocolUnregisterForEvent](/zh-TW/reference/system/xgameprotocol/functions/xgameprotocolunregisterforactivation)。

## 需求

**標頭：** XGameProtocol.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[XGameProtocol 成員](/zh-TW/reference/system/xgameprotocol/xgameprotocol_members)


## Related topics

- [XGameProtocolRegisterForActivation (deprecated)](/zh-CN/reference/system/xgameprotocol/functions/xgameprotocolregisterforactivation.md)
- [XGameProtocolRegisterForActivation (en desuso)](/es/reference/system/xgameprotocol/functions/xgameprotocolregisterforactivation.md)
- [XGameProtocolActivationCallbackXGameProtocol (deprecated)](/reference/system/xgameprotocol/functions/xgameprotocolactivationcallback.md)
- [XGameProtocol (deprecated)](/reference/system/xgameprotocol/xgameprotocol_members.md)
- [XGameActivation](/reference/system/xgameactivation/xgameactivation_members.md)
