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

# XUserRegisterForDeviceAssociationChanged

> XUserRegisterForDeviceAssociationChanged

# XUserRegisterForDeviceAssociationChanged

Registers a callback for user device association change events.

## Syntax

```cpp theme={null}
HRESULT XUserRegisterForDeviceAssociationChanged(  
         XTaskQueueHandle queue,  
         void* context,  
         XUserDeviceAssociationChangedCallback* callback,  
         XTaskQueueRegistrationToken* token  
)  
```

### Parameters

*queue*   \_In\_opt\_\
Type: XTaskQueueHandle

A handle to the asynchronous queue to put the change callback on.

*context*   \_In\_opt\_\
Type: void\*

A callback the application defines and passes back to the callback.

*callback*   \_In\_\
Type: [XUserDeviceAssociationChangedCallback\*](/reference/system/xuser/functions/xuserdeviceassociationchangedcallback)

A callback the application defines and registers.

*token*   \_Out\_\
Type: [XTaskQueueRegistrationToken\*](/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken)

On success contains a token identifying the callback you can use to un-register the callback.

### Return value

Type: HRESULT

HRESULT success or error code.\
For a list of error codes, see [Error Codes](/reference/errorcodes).

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Calling **XUserDeviceAssociationRegisterForChangeEvent** does not invalidate previously registered callbacks.

To unregister a user device association change callback, call [XUserUnregisterForDeviceAssociationChanged](/reference/system/xuser/functions/xuserunregisterfordeviceassociationchanged).

To register a callback that the application defines and invokes when the default endpoint changes, call [XUserRegisterForDefaultAudioEndpointUtf16Changed](/reference/system/xuser/functions/xuserregisterfordefaultaudioendpointutf16changed).

To unregister a default audio endpoint change callback, call [XUserUnregisterForDefaultAudioEndpointUtf16Changed](/reference/system/xuser/functions/xuserunregisterfordefaultaudioendpointutf16changed).

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

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

## See also

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

[XUserUnregisterForDeviceAssociationChanged](/reference/system/xuser/functions/xuserunregisterfordeviceassociationchanged)

[XUserRegisterForDefaultAudioEndpointUtf16Changed](/reference/system/xuser/functions/xuserregisterfordefaultaudioendpointutf16changed)

[XUserUnregisterForDefaultAudioEndpointUtf16Changed](/reference/system/xuser/functions/xuserunregisterfordefaultaudioendpointutf16changed)


## Related topics

- [XUserDeviceAssociationChangedCallback](/reference/system/xuser/functions/xuserdeviceassociationchangedcallback.md)
- [XUserUnregisterForDeviceAssociationChanged](/reference/system/xuser/functions/xuserunregisterfordeviceassociationchanged.md)
- [XUserDeviceAssociationChange](/reference/system/xuser/structs/xuserdeviceassociationchange.md)
- [XUserRegisterForDefaultAudioEndpointUtf16Changed](/reference/system/xuser/functions/xuserregisterfordefaultaudioendpointutf16changed.md)
- [XUserFindForDevice](/reference/system/xuser/functions/xuserfindfordevice.md)
