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

# XSystemGetAnalyticsInfo

> XSystemGetAnalyticsInfo

# XSystemGetAnalyticsInfo

提供遊戲執行所在之作業系統和裝置的診斷資訊。

## 語法

```cpp theme={null}
XSystemAnalyticsInfo XSystemGetAnalyticsInfo(  
)  
```

### 參數

無。

### 傳回值

類型：[XSystemAnalyticsInfo](/zh-TW/reference/system/xsystem/structs/xsystemanalyticsinfo)

傳回包含目前裝置相關資訊的 [XSystemAnalyticsInfo](/zh-TW/reference/system/xsystem/structs/xsystemanalyticsinfo) 結構。

## 備註

<Note>在時間敏感執行緒上呼叫此函式並不安全。如需詳細資訊，請參閱[時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

**XSystemGetAnalyticsInfo** 函式會傳回包含目前裝置診斷資訊的 [XSystemAnalyticsInfo](/zh-TW/reference/system/xsystem/structs/xsystemanalyticsinfo) 結構。此資訊包括遊戲執行所在之作業系統的版本、遊戲啟動來源之作業系統的版本，以及裝置的系列和外型。

下列範例說明如何藉由叫用 **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

**程式庫：** xgameruntime.lib

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

## 概念文件

* [時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另請參閱

[XSystem](/zh-TW/reference/system/xsystem/xsystem_members)\
[XSystemAnalyticsInfo](/zh-TW/reference/system/xsystem/structs/xsystemanalyticsinfo)


## Related topics

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