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

# XUserDeviceAssociationChangedCallback

> XUserDeviceAssociationChangedCallback

# XUserDeviceAssociationChangedCallback

在使用者與裝置的關聯變更時叫用的回呼。

## 語法

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

### 參數

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

應用程式定義的內容，會在註冊回呼期間傳送至 [XUserRegisterForDeviceAssociationChanged](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged.md)。

*change*   \_In\_\
類型：[XUserDeviceAssociationChange\*](https://docs.xbox.com/zh-TW/reference/system/xuser/structs/xuserdeviceassociationchange.md)

包含舊的和新的裝置關聯的結構。

### 傳回值

類型：void

## 備註

若要為使用者裝置關聯變更事件註冊回呼，請呼叫 [XUserRegisterForDeviceAssociationChanged](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged.md)。此函式會接受指向 **XUserDeviceAssociationChangedCallback** 函式的指標作為引數。此函式會傳回回呼函式的指標。

## 需求

**標頭：** XUser.h

**程式庫：** xgameruntime.lib

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

## 另請參閱

[XUser](https://docs.xbox.com/zh-TW/reference/system/xuser/xuser_members.md)

[XUserRegisterForDeviceAssociationChanged](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged.md)


## Related topics

- [XUserDeviceAssociationChange](https://docs.xbox.com/zh-TW/reference/system/xuser/structs/xuserdeviceassociationchange.md)
- [XUserFindForDevice](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserfindfordevice.md)
- [XUserRegisterForDeviceAssociationChanged](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserregisterfordeviceassociationchanged.md)
- [使用者與控制器的關聯何時發生？](https://docs.xbox.com/zh-TW/build/core-features/common/user/users-timing-of-user-to-device-association.md)
- [XUserFindControllerForUserWithUiAsync](https://docs.xbox.com/zh-TW/reference/system/xuser/functions/xuserfindcontrollerforuserwithuiasync.md)
