我需要将客户端计算机上运行的Windows版本存储在一个变量中。我在使用Windows10的VersionHelper.h,计算机上遇到问题,显示为Windows8,如何解决此问题?
我使用的是Visual Studio 2015,目标平台版本:10.0.10586.0
if (IsWindows7SP1OrGreater())
{
strcpy_s(this->OS_Detect, "Windows 7 SP1");
}
if (IsWindows8OrGreater())
{
strcpy_s(this->OS_Detect, "Windows 8");
}
if (IsWindows8Point1OrGreater())
{
strcpy_s(this->OS_Detect, "Windows 8.1");
}
if (IsWindows10OrGreater())
{
strcpy_s(this->OS_Detect, "Windows 10");
}
windows 10 = "Windows 8“计算机的返回
发布于 2016-02-18 14:28:34
必须在应用程序清单文件中包含<compatibility>
标志
另请参阅Targeting your application for Windows
如果您还没有清单文件,请使用记事本创建名为"appname.exe.manifest“的文件
添加以下内容:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 10 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8 -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows Vista -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 7 -->
</application>
</compatibility>
</assembly>
接下来,将此文件拖放到Visual Studio 2015项目中。
对于较早的VS版本,您必须在项目->清单部分中指定文件名
https://stackoverflow.com/questions/35474237
复制相似问题