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

# XSystemAnalyticsInfo

> XSystemAnalyticsInfo

# XSystemAnalyticsInfo

代表目前裝置的相關資訊。

## 語法

```cpp theme={null}
typedef struct XSystemAnalyticsInfo {  
    XVersion osVersion;  
    XVersion hostingOsVersion;  
    char family[64];  
    char form[64];  
} XSystemAnalyticsInfo  
```

### 成員

*osVersion*\
類型：[XVersion](/zh-TW/reference/system/xgameruntimetypes/structs/xversion)

遊戲執行所在之作業系統的版本。對於 XBOX 裝置，此值代表遊戲 OS 的版本。對於桌上型裝置，此值代表系統 OS 的版本。

*hostingOsVersion*\
類型：[XVersion](/zh-TW/reference/system/xgameruntimetypes/structs/xversion)

遊戲啟動來源之作業系統的版本。對於 XBOX 裝置，此值代表系統 OS 的版本。對於桌上型裝置，此值通常與 *osVersion* 的值相同。

*family*\
類型：char\[64]

裝置系列的一般描述。範例："XBOX" 和 "Windows"。

*form*\
類型：char\[64]

裝置系列中的特定硬體類型。範例："XBOX One X DevKit"。

## 備註

呼叫 [XSystemGetAnalyticsInfo](/zh-TW/reference/system/xsystem/functions/xsystemgetanalyticsinfo) 時會傳回此結構。此結構提供目前裝置的作業系統版本、裝置系列和裝置外型。

下列範例說明如何藉由叫用 **XSystemGetAnalyticsInfo** 並串連 **XSystemAnalyticsInfo** 的 *osVersion* 成員中傳回的結果，來擷取遊戲執行所在之作業系統的版本資訊。

```cpp theme={null}
// Get the version of the operating system in which the game is running.
std::string Game::GetGameOSVersion()
{
    // Call XSystemGetAnalyticsInfo()
    XSystemAnalyticsInfo info = XSystemGetAnalyticsInfo();

    // Return a formatted string from the osVersion member of XSystemAnalyticsInfo.
    return std::to_string(info.osVersion.major) + "." +
        std::to_string(info.osVersion.minor) + "." +
        std::to_string(info.osVersion.build) + "." +
        std::to_string(info.osVersion.revision);

}
```

## 需求

**標頭：** XSystem.h

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

## 另請參閱

[XSystem](/zh-TW/reference/system/xsystem/xsystem_members)\
[XSystemGetAnalyticsInfo](/zh-TW/reference/system/xsystem/functions/xsystemgetanalyticsinfo)\
[XVersion](/zh-TW/reference/system/xgameruntimetypes/structs/xversion)


## Related topics

- [XSystemAnalyticsInfo](/reference/system/xsystem/structs/xsystemanalyticsinfo.md)
- [XSystemGetAnalyticsInfo](/reference/system/xsystem/functions/xsystemgetanalyticsinfo.md)
