How can I detect Windows 8.1 in a Desktop application

Take a look at this article:

Operating system version changes in Windows 8.1 Preview

GetVersion(Ex) APIs have been deprecated. That means that while you can still call the APIs, if your app does not specifically target Windows 8.1 Preview, you will get Windows 8 versioning (6.2.0.0).

What it says is that GetVersion lies to you about the real OS version unless you explicitly direct 8.1 in your manifest.

You need to add the following to the app manifest:

 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    <application> 
      * <!-- 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}"/>
    </application> 
</compatibility>

If you don’t want to do that you can check the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

Current version will give you 6.3

Current build nmber will be 9431

Leave a Comment