WIN10以后如果Manifest中不写支持WIN10的话,获取版本号的API获取的是6

  if TOSVersion.Major = 10 then  // 高版本的Delphi(比如Berlin)可以这样写

    ShowMessage('Windows 10');

或者:

   if Win32MajorVersion = 10 then

WIN10以后如果Manifest中不写支持WIN10的话,获取版本号的API获取的是6,最新版的Delphi的manifest中写了支持WIN10,所以没问题。
老版本Delphi要自己写manifest中间加上
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
          <!-- Windows 10 --> 
          <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
          <!-- Windows 8.1 -->
          <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
          <!-- Windows Vista -->
          <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
          <!-- Windows 7 -->
          <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
          <!-- Windows 8 -->
          <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>    
    
          <!--This Id value indicates the application supports Windows Vista/Server 2008 functionality -->
          <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
          <!--This Id value indicates the application supports Windows 7/Server 2008 R2 functionality-->
          <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
          <!--This Id value indicates the application supports Windows 8/Server 2012 functionality-->
          <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
          <!-- This Id value indicates the application supports Windows Blue/Server 2012 R2 functionality-->
          <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
          <!-- This Id value indicates the application supports Windows Threshold functionality-->
          <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
        </application>
    </compatibility>

http://bbs.2ccc.com/topic.asp?topicid=529101

原文地址:https://www.cnblogs.com/findumars/p/6557413.html