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

# XGameStreamingRegisterClientPropertiesChanged

> XGameStreamingRegisterClientPropertiesChanged

# XGameStreamingRegisterClientPropertiesChanged

いずれかのストリーミング クライアント デバイスのプロパティが変更された際に呼び出されるコールバックを登録します。

<Note>登録時に、クライアント デバイスの現在のクライアント プロパティに対してコールバックが呼び出されます。</Note>

## Syntax

```cpp theme={null}
HRESULT XGameStreamingRegisterClientPropertiesChanged(  
         XGameStreamingClientId client,  
         XTaskQueueHandle queue,  
         void* context,  
         XGameStreamingClientPropertiesChangedCallback* callback,  
         XTaskQueueRegistrationToken* token  
)  
```

### Parameters

*client*   \_In\_\
型: XGameStreamingClientId

コールバックを受け取るために登録するゲーム ストリーミング クライアントの ID。

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

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

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

コールバック関数に渡されるコンテキストへの任意のポインター。

*callback*   \_In\_\
型: [XGameStreamingClientPropertiesChangedCallback\*](/reference/system/xgamestreaming/functions/xgamestreamingclientpropertieschangedcallback)

クライアントのプロパティが変更されたときに呼び出されるコールバック関数。

*token*   \_Out\_\
型: XTaskQueueRegistrationToken\*

イベントの登録解除に使用できる登録トークンへのポインター。

### Return value

型: HRESULT

成功した場合は **S\_OK** を返します。それ以外の場合はエラー コードを返します。

#### 想定されるエラー

| エラー コード                                  | エラー値       | エラーの理由                                                                                                                                                     |
| ---------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED       | 0x89245400 | XGameStreaming ランタイムが初期化されていません。他の API を呼び出す前に [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize) を呼び出してください。 |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401 | 指定されたクライアントが接続されていません。                                                                                                                                     |

エラー コードの一覧については、[Error Codes](/reference/errorcodes) を参照してください。

## Remarks

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

この API を使用すると、ストリームの物理的な寸法などの [XGameStreamingClientProperty](/reference/system/xgamestreaming/enums/xgamestreamingclientproperty) が変更されたときに、ゲームが `XGameStreamingClientPropertiesChangedCallback` を受け取れるようになります。

登録により、該当するすべての `XGameStreamingClientProperty` に対してコールバックが **呼び出されます**。これにより、現在のプロパティの詳細を照会できます。

ストリーミング クライアント デバイスが切断されたら、[XGameStreamingUnregisterClientPropertiesChanged](/reference/system/xgamestreaming/functions/xgamestreamingunregisterclientpropertieschanged) を使用してコールバックの登録を解除してください。

## Example

```cpp theme={null}
    // On client connection maintain a list of clients and do per client initialization
    void GameStreamingClientManager::OnClientConnected(XGameStreamingClientId client)
    {
        StreamingClient connectedClient;
        connectedClient.clientId = client;
        connectedClient.propertiesChangedToken = token;

        // Do per-client initialization
        XGameStreamingClientPropertiesChangedRegistrationToken token = {0};
        XGameStreamingRegisterClientPropertiesChanged(
            client, m_taskQueue, this, &OnClientPropertiesChanged, &token);        

        connectedClient.propertiesChangedToken = token;
        m_streamingClients.push_back(connectedClient);
    }

    // Some of the properties of our streaming client have changed, react to any of the changes which apply to our game
    void GameStreamingClientManager::OnClientPropertiesChanged(
        void* context,
        XGameStreamingClientId client,
        uint32_t updatedPropertiesCount,
        XGameStreamingClientProperty* updatedProperties)
    {
        GameStreamingClientManager* gsClientManager = reinterpret_cast<GameStreamingClientManager*>(context);

        for (uint32_t i = 0; i < updatedPropertiesCount; ++i)
        {
            switch (updatedProperties[i])
            {
                // The client now has a new physical size of the game stream - update our list of stream
                // sizes to reflect this.
            case XGameStreamingClientProperty::StreamPhysicalDimensions:
                gsClientManager->UpdateClientPhysicalDimensions(client); 
                break;

            case XGameStreamingClientProperty::TouchInputEnabled: 
                gsClientManager->UpdateClientTouchEnabled(client); 
                break;

            default:
                // A characteristic we are not tracking - do nothing
                break;
            }
        }
    }

```

## Requirements

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

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

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

## Conceptual documentation

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

## See also

[XGameStreamingClientProperty](/reference/system/xgamestreaming/enums/xgamestreamingclientproperty)\
[XGameStreamingClientPropertiesChangedCallback](/reference/system/xgamestreaming/functions/xgamestreamingclientpropertieschangedcallback)\
[XGameStreamingUnregisterClientPropertiesChanged](/reference/system/xgamestreaming/functions/xgamestreamingunregisterclientpropertieschanged)\
[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members)


## Related topics

- [XGameStreamingClientPropertiesChangedCallback](/ja-jp/reference/system/xgamestreaming/functions/xgamestreamingclientpropertieschangedcallback.md)
- [XGameStreamingUnregisterClientPropertiesChanged](/ja-jp/reference/system/xgamestreaming/functions/xgamestreamingunregisterclientpropertieschanged.md)
- [XGameStreamingClientProperty](/ja-jp/reference/system/xgamestreaming/enums/xgamestreamingclientproperty.md)
- [XGameStreamingIsTouchInputEnabled](/ja-jp/reference/system/xgamestreaming/functions/xgamestreamingistouchinputenabled.md)
- [XGameStreamingGetSessionId](/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggetsessionid.md)
