c++ - Windows XP 的版本帮助函数

标签 c++ visual-c++ visual-studio-2013 windows-xp

在我的应用程序中,我需要检查 Windows 版本。我正在使用 Version Helper functionsVisual Studio 2013 (v120) 平台工具集中。但是该程序在 Windows XP 中无法运行。错误是:

'xxx.exe' is not a valid win32 application

所以我将平台工具集更改为 Visual Studio 2013 - Windows XP (v120_xp)。但在这种情况下,应用程序将无法编译。 错误是:

error C1083: Cannot open include file: 'VersionHelpers.h': No such file or directory

我能做什么?我可以用旧的 GetVersionEx 吗?功能? MSDN 说:

GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper APIs

但也许我现在应该使用它!

最佳答案

我已经使用 Remmy Lebeau 的评论设法解决了这个问题。

我从 C:\Program Files (x86)\Windows Kits\8.1\Include\umwinapifamily.h 复制了 VersionHelpers.h > 和 C:\Program Files (x86)\Windows Kits\8.1\Include\shared 中的 sdkddkver.h 到我的项目中,并更改了其中的一些内容。

现在它可以使用 Windows XP 工具集进行编译。

我已经对其进行了测试,它在所有版本的 Windows 中都按预期工作。

关于c++ - Windows XP 的版本帮助函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26829896/

相关文章:

c++ - 为什么我将函数命名为 `swap` 时会出现模板错误,但 `Swap` 没问题?

visual-c++ - MFC画线

windows - 将谷歌广告添加到 Windows Phone 8.1 应用程序

c++ - sin(<minus zero>) 未在 Visual Studio 2013 64 位上返回预期结果

c# - 防止在 IIS 中加载特定的 dll

c++ - 从 "dumb"基类构造对象

c++ - 字符串转char*函数

我可以告诉 MSVC 编译器不要使用某个寄存器吗?

转换问题: __asm__ __volatile__ from GNU C to MSVC for in/out wrappers

c# - 将 C# Intellisense 更改为更像 VB