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

ユーザー デバイス関連付けの変更イベントに対するコールバックを登録します。

## 構文

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

### パラメーター

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

変更コールバックを配置する非同期キューへのハンドルです。

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

アプリケーションが定義し、コールバックに再び渡されるコールバックです。

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

アプリケーションが定義し、登録するコールバックです。

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

成功時に、コールバックを識別するトークンが格納されます。このトークンを使ってコールバックを登録解除できます。

### 戻り値

Type: HRESULT

HRESULT の成功またはエラー コード。\
エラー コードの一覧については、[エラー コード](/reference/errorcodes) を参照してください。

## 解説

<Note>この関数は、時間依存スレッドから呼び出しても安全ではありません。詳細については、[時間依存スレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。</Note>

**XUserDeviceAssociationRegisterForChangeEvent** を呼び出しても、以前に登録されたコールバックは無効化されません。

ユーザー デバイス関連付けの変更コールバックを解除するには、[XUserUnregisterForDeviceAssociationChanged](/reference/system/xuser/functions/xuserunregisterfordeviceassociationchanged) を呼び出します。

既定のエンドポイントが変更されたときにアプリケーションが定義して呼び出すコールバックを登録するには、[XUserRegisterForDefaultAudioEndpointUtf16Changed](/reference/system/xuser/functions/xuserregisterfordefaultaudioendpointutf16changed) を呼び出します。

既定のオーディオ エンドポイント変更コールバックを解除するには、[XUserUnregisterForDefaultAudioEndpointUtf16Changed](/reference/system/xuser/functions/xuserunregisterfordefaultaudioendpointutf16changed) を呼び出します。

## 要件

**ヘッダー:** XUser.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリ本体および XBOX Series 本体

## 概念ドキュメント

* [時間依存スレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 関連項目

[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

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