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

# XGameStreamingGetStreamPhysicalDimensions

> XGameStreamingGetStreamPhysicalDimensions

# XGameStreamingGetStreamPhysicalDimensions

取得視訊串流在串流用戶端上轉譯時的實體尺寸。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
HRESULT XGameStreamingGetStreamPhysicalDimensions(
         XGameStreamingClientId client,
         uint32_t* horizontalMm,
         uint32_t* verticalMm
)
```

<a id="parametersSection" />

### 參數

*client*   \_In\_\
類型：XGameStreamingClientId

要查詢其實體大小的用戶端。

*horizontalMm*   \_Out\_\
類型：uint32\_t\*

視訊串流水平軸的大小 (以公釐為單位)。

*verticalMm*   \_Out\_\
類型：uint32\_t\*

視訊串流垂直軸的大小 (以公釐為單位)。

<a id="retvalSection" />

### 傳回值

類型：HRESULT

如果成功，則傳回 **S\_OK**；否則傳回錯誤碼。

**可能的錯誤**

| 錯誤碼 | 錯誤值 | 錯誤原因 |
| - | - | - |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | XGameStreaming 執行階段尚未初始化。請先呼叫 [XGameStreamingInitialize](/zh-TW/reference/system/xgamestreaming/functions/xgamestreaminginitialize)，再呼叫其他 API。 |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401 | 指定的用戶端未連線。 |
| E\_GAMESTREAMING\_NO\_DATA | 0x89245402 | 要求的資料無法使用。資料稍後可能會可供使用。 |

如需錯誤碼清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

<a id="remarksSection" />

## 備註

您可以使用此方法來判斷串流是否會傳送至較小的裝置 (例如智慧型手機)。

這可讓您根據裝置大小，提供對玩家更友善且適合裝置的體驗 (例如，使用較大的字型大小)。

如果您希望遊戲回應串流實體尺寸的變更，則應透過 [XGameStreamingRegisterClientPropertiesChanged](/zh-TW/reference/system/xgamestreaming/functions/xgamestreamingregisterclientpropertieschanged) 註冊回呼。

<a id="exampleSection" />

## 範例

下列程式碼範例示範如何使用 `XGameStreamingGetStreamPhysicalDimensions` 函式來找出串流用戶端的最小尺寸。

```cpp theme={null}
void GetSmallestStreamingClient(uint32_t& widthMm, uint32_t& heightMm)
    {
        // If we don't know what the smallest client is, then search through them to find it
        if (m_smallestClient == XGameStreamingNullClientId)
        {
            for (const auto client : m_streamingClients)
            {
                if (client.clientId != XGameStreamingNullClientId)
                {
                    uint32_t clientWidthMm = 0;
                    uint32_t clientHeightMm = 0;
                    if (SUCCEEDED(XGameStreamingGetStreamPhysicalDimensions(client.clientId, &clientWidthMm, &clientHeightMm)))
                    {
                        if (clientWidthMm < m_smallestClientWidthMm)
                        {
                            m_smallestClientWidthMm = clientWidthMm;
                            m_smallestClientHeightMm = clientHeightMm;
                        }
                    }
                }
            }
        }

        widthMm = m_smallestClientWidthMm;
        heightMm = m_smallestClientHeightMm;
    }
```

<a id="requirementsSection" />

## 需求

**標頭：** xgamestreaming.h

**程式庫：** xgameruntimelib

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

<a id="seealsoSection" />

## 另請參閱

[XGameStreaming](/zh-TW/reference/system/xgamestreaming/xgamestreaming_members)\
[XGameStreamingRegisterClientPropertiesChanged](/zh-TW/reference/system/xgamestreaming/functions/xgamestreamingregisterclientpropertieschanged)\
[XGameStreaming](/zh-TW/reference/system/xgamestreaming/xgamestreaming_members#ClientProperties)


## Related topics

- [XGameStreamingGetStreamPhysicalDimensions](/reference/system/xgamestreaming/functions/xgamestreaminggetstreamphysicaldimensions.md)
- [XGameStreamingClientProperty](/reference/system/xgamestreaming/enums/xgamestreamingclientproperty.md)
- [Optimizing your game for XBOX Game Streaming](/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)
- [XBOX Game Streaming을 위한 게임 최적화](/ko/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)
