Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 需要检测Windows版本的帮助(特别是,我无法检测到我自己的计算机为10)_C++_Windows_Visual Studio 2015_Windows 10 - Fatal编程技术网

C++ 需要检测Windows版本的帮助(特别是,我无法检测到我自己的计算机为10)

C++ 需要检测Windows版本的帮助(特别是,我无法检测到我自己的计算机为10),c++,windows,visual-studio-2015,windows-10,C++,Windows,Visual Studio 2015,Windows 10,在VS2015中,我使用了versionhelpers.h中一个名为“isWindowsVersionOrCreater”的方法,该方法返回一个布尔值 它有三个参数:wMajorVersion、wMinorVersion、wServicePackMajor 对于Windows7,这是:6,1,0 对于Windows 8,这是:6、2、0 对于Windows 8.1,这是:6、3、0 对于Windows 10,这是:10,0,0 (来源:) 但当我运行以下命令时 if (IsWindowsVers

在VS2015中,我使用了versionhelpers.h中一个名为“isWindowsVersionOrCreater”的方法,该方法返回一个布尔值

它有三个参数:wMajorVersion、wMinorVersion、wServicePackMajor

对于Windows7,这是:6,1,0

对于Windows 8,这是:6、2、0

对于Windows 8.1,这是:6、3、0

对于Windows 10,这是:10,0,0

(来源:)

但当我运行以下命令时

if (IsWindowsVersionOrGreater(10,0,0)) std::cout << true << std::endl;
else std::cout << false << std::endl;

if(isWindowsVersionOrCreater(10,0,0))std::注意到早期的Windows 10 Beta版本标记为“6.4”版本,而不是后者采用的市场名称“10.0”。此外,您的程序是否明确显示为“与Windows 10兼容”?从Windows 8开始,您需要(通过其清单)针对特定版本的Windows将应用程序作为目标,以便将这些版本报告为当前版本号。更多信息。控制台窗口本身可能发生了一些变化,但通常具有相同的编程行为,对于大多数用途来说,这并不重要。为什么对Windows 10进行特殊处理很重要?除非您向程序中添加一个清单,表明它与Windows 10兼容,否则您将无法检测到您正在使用该方法(或通过
GetVersionEx
)在Windows 10上运行。还有另一种方法,检查其中一个系统DLL的版本资源。请注意,早期的Windows 10 Beta将其标记为版本“6.4”,而不是后者采用的市场名称“10.0”。此外,您的程序是否明确显示为“与Windows 10兼容”?从Windows 8开始,您需要(通过其清单)针对特定版本的Windows将应用程序作为目标,以便将这些版本报告为当前版本号。更多信息。控制台窗口本身可能发生了一些变化,但通常具有相同的编程行为,对于大多数用途来说,这并不重要。为什么对Windows 10进行特殊处理很重要?除非您向程序中添加一个清单,表明它与Windows 10兼容,否则您将无法检测到您正在使用该方法(或通过
GetVersionEx
)在Windows 10上运行。还有另一种方法,检查其中一个系统DLL的版本资源。