Compartilhar via


XSystemGetAnalyticsInfo

Provides diagnostic information about the operating system and device on which the game is running.

Syntax

XSystemAnalyticsInfo XSystemGetAnalyticsInfo(  
)  

Parameters

None.

Return value

Type: XSystemAnalyticsInfo

Returns an XSystemAnalyticsInfo structure that contains information about the current device.

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

The XSystemGetAnalyticsInfo function returns an XSystemAnalyticsInfo structure that contains diagnostic information about the current device. This information includes the versions of both the operating system in which the game is running and the operating system from which the game was launched, as well as the family and form of the device.

The following example illustrates how to retrieve the version information for the operating system in which a game is running, by invoking XSystemGetAnalyticsInfo and concatenating the results returned in the osVersion member of XSystemAnalyticsInfo.

// 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);

}

Requirements

Header: XSystem.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XSystem
XSystemAnalyticsInfo