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

# XAppBroadcastRegisterIsAppBroadcastingChanged

> XAppBroadcastRegisterIsAppBroadcastingChanged

# XAppBroadcastRegisterIsAppBroadcastingChanged

注册一个应用广播状态更改事件处理程序。

## 语法

```cpp theme={null}
HRESULT XAppBroadcastRegisterIsAppBroadcastingChanged(  
         XTaskQueueHandle queue,  
         void* context,  
         XAppBroadcastMonitorCallback* appBroadcastMonitorCallback,  
         XTaskQueueRegistrationToken* token  
)  
```

### 参数

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

可选的 XTaskQueueHandle，用户可创建自己的回调，并从此队列执行。

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

要传递给回调函数的可选信息。

*appBroadcastMonitorCallback*   \_In\_\
类型：XAppBroadcastMonitorCallback\*

在能否进行广播的状态发生变化时的回调。游戏可利用此回调来判断是否可以安全地启用显示广播 UI。

*token*   \_Out\_\
类型：XTaskQueueRegistrationToken\*

广播令牌。

### 返回值

类型：HRESULT

函数结果。

## 备注

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

每次调用 **AppBroadcastRegisterIsAppBroadcastingChanged** 后，当不再需要该事件处理程序时，都应调用 [XAppBroadcastUnregisterIsAppBroadcastingChanged](/reference/system/xappcapture/functions/xappbroadcastunregisterisappbroadcastingchanged)。未调用取消注册函数将会导致内存泄漏。此函数将注册第二个函数 [XAppBroadcastMonitorCallback](/reference/system/xappcapture/functions/xappbroadcastmonitorcallback)，该函数将在应用广播状态变化时被调用。

## 要求

**头文件：** XAppCapture.h

**库：** xgameruntime.lib

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

## 概念性文档

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

## 另请参阅

[GameDVR 概览](/build/console-features/game-dvr/gamedvr-broadcast)\
[XAppCapture 成员](/reference/system/xappcapture/xappcapture_members)\
[XAppBroadcastUnregisterIsAppBroadcastingChanged](/reference/system/xappcapture/functions/xappbroadcastunregisterisappbroadcastingchanged)\
[XAppBroadcastMonitorCallback](/reference/system/xappcapture/functions/xappbroadcastmonitorcallback)


## Related topics

- [XAppBroadcastUnregisterIsAppBroadcastingChanged](/zh-CN/reference/system/xappcapture/functions/xappbroadcastunregisterisappbroadcastingchanged.md)
- [XAppBroadcastMonitorCallback](/zh-CN/reference/system/xappcapture/functions/xappbroadcastmonitorcallback.md)
- [XTaskQueueRegistrationToken](/zh-CN/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken.md)
- [XAppCapture](/zh-CN/reference/system/xappcapture/xappcapture_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
