在我的应用程序中,我需要检查 Windows 版本。我正在使用 Version Helper functions在 Visual 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\um
和 winapifamily.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/