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

# XGameStreamingGetTouchBundleVersion

> XGameStreamingGetTouchBundleVersion

# XGameStreamingGetTouchBundleVersion

取得指定裝置目前所使用之觸控調整套件組合的版本。

## 語法

```cpp theme={null}
HRESULT XGameStreamingGetTouchBundleVersion(  
        XGameStreamingClientId client,
        XVersion* version,
        size_t versionNameSize,
        char* versionName
)  
```

### 參數

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

要查詢的串流用戶端。

*version*   \_Out\_opt\_\
類型：XVersion\*

指定用戶端目前所使用之套件組合的版本號碼。如果套件組合中未指定版本號碼，將傳回 0.0.0.0。

*versionNameSize*   \_In\_\
類型：size\_t

要傳回之 `versionName` 的大小上限 (以位元組為單位)。可呼叫 [XGameStreamingGetTouchBundleVersionNameSize](/zh-TW/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize) 來取得要指定的大小。

*versionName*   \_Out\_writes\_opt\_z\_\
類型：char\*

指定用戶端目前所使用之套件組合的版本名稱。如果套件組合中未指定版本名稱，將傳回 `null`。

### 傳回值

類型：HRESULT

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

#### 可能的錯誤

| 錯誤碼 | 錯誤值 | 錯誤原因 |
| - | - | - |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | XGameStreaming 執行階段尚未初始化。請先呼叫 [XGameStreamingInitialize](/zh-TW/reference/system/xgamestreaming/functions/xgamestreaminginitialize)，再呼叫其他 API。 |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401 | 指定的用戶端未連線。 |

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

## 備註

遊戲串流期間呈現給玩家的觸控配置，使用的是預先定義的配置，這些配置會作為觸控調整套件組合的一部分上傳至 Microsoft。`XGameStreamingGetTouchBundleVersion` 可讓遊戲根據特定用戶端上所使用的觸控控制項集合，在執行階段做出決策。以下是可能使用此功能的一些範例：

* 如果玩家正在使用觸控，且某個元素可透過觸控覆疊控制項取得，則從 HUD 中移除該元素。
* 根據將顯示的觸控配置，決定要在遊戲中顯示哪些圖形提示。

`version` 對於上傳至服務的每個版本都是唯一的。每次更新都需要新的版本號碼。

`versionName` 可用來提供語意版本 (例如，這是一組支援 DLC2 的配置)，而不是鎖定特定的版本號碼。例如，如果版本號碼是由您的建置系統自動指派，遊戲程式碼可能很難知道執行階段會出現之觸控調整套件組合的確切版本號碼。為了讓程式碼能夠偵測套件組合是否存在，而不需要知道其確切版本，可以選擇使用版本名稱，而不是根據版本號碼進行比較。

## 範例

```C++ theme={null}
void GameStreamingClientManager::GetClientTouchBundleVersion(XGameStreamingClientId client)
{
    // Get the touch bundle version and initialize the touch HUD based on the 
    // semantic version name that was returned
    
    size_t versionNameSize = XGameStreamingGetTouchBundleVersionNameSize(clientId);

    XVersion version{};
    std::vector<char> versionName(versionNameSize, 0);
    XGameStreamingGetTouchBundleVersion(clientId, &version, versionNameSize, &versionName[0]);

    InitializeTouchHUD(versionName);

    if (strcmp("DLC2", versionName.data()) == 0)
    {
        // we have our DLC2 controls, switch to the HUD layout that works best with those overlay controls.
        InitializeHUDForDLC2TouchControls();
    }
}
```

## 需求

**標頭：** XGameStreaming.h

**程式庫：** xgameruntime.lib

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

## 另請參閱

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


## Related topics

- [XGameStreamingGetTouchBundleVersion](/es/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversion.md)
- [XGameStreamingGetTouchBundleVersionNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize.md)
