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

# XUserDeviceAssociationChangedCallback

> XUserDeviceAssociationChangedCallback

# XUserDeviceAssociationChangedCallback

用户-设备关联发生更改时调用的回调。

## 语法

```cpp theme={null}
void XUserDeviceAssociationChangedCallback(  
         void* context,  
         const XUserDeviceAssociationChange* change  
)  
```

### 参数

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

在回调注册期间，应用程序定义并发送给 [XUserRegisterForDeviceAssociationChanged](/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged) 的上下文。

*change*   \_In\_\
类型：[XUserDeviceAssociationChange\*](/reference/system/xuser/structs/xuserdeviceassociationchange)

包含新旧设备关联的结构。

### 返回值

类型：void

## 注解

若要为用户设备关联更改事件注册回调，请调用 [XUserRegisterForDeviceAssociationChanged](/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged)。该函数接受指向 **XUserDeviceAssociationChangedCallback** 函数的指针作为参数。该函数返回指向回调函数的指针。

## 要求

**头文件：** XUser.h

**库：** xgameruntime.lib

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

## 另请参阅

[XUser](/reference/system/xuser/xuser_members)

[XUserRegisterForDeviceAssociationChanged](/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged)


## Related topics

- [XUserDeviceAssociationChange](/zh-CN/reference/system/xuser/structs/xuserdeviceassociationchange.md)
- [XUserFindForDevice](/zh-CN/reference/system/xuser/functions/xuserfindfordevice.md)
- [XUserRegisterForDeviceAssociationChanged](/zh-CN/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged.md)
- [用户与手柄的关联在何时发生?](/zh-CN/build/core-features/common/user/users-timing-of-user-to-device-association.md)
- [XR-115 在游戏中添加和移除用户或控制器](/zh-CN/publishing/certification/xr/xr-115.md)
