LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetWinOSVersion in CVI2017 returns wrong numbers

Solved!
Go to solution

I have been using GetWinOSVersion  in CVI2012 and gets what is supposed to return.    However I an moving my application to CVI2017 and when I run my app in Windows 10,  it returns Major Version = 10, minus version = 0.   Its supposed to return 6 & 2.

 

GetWinOSVersion (&_Info_system.majorVersion , &_Info_system.minorVersion, &_Info_system.build, &_Info_system.platform);

 

If I compile same application in CVI2102, it returns correct values.  Problem only happens when I compile it in CVI2017.

Thanks

 

0 Kudos
Message 1 of 6
(2,553 Views)
Solution
Accepted by topic author jabara80

According to this, Windows 10 has version 10.0, while 6.2 is for Windows 8

0 Kudos
Message 2 of 6
(2,527 Views)
Solution
Accepted by topic author jabara80

Hello jabara,

 

I can confirm that I see the same behavior (Windows 10 (1607), CVI2017):

2019-02-12_13-02-55.png

 

 

According to Operating System Version - Microsoft Docs, this is expected behavior:

For applications that have been manifested for Windows 8.1 or Windows 10. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). To manifest your applications for Windows 8.1 or Windows 10, refer to Targeting your application for Windows.


 

So I think I can explain why this is.

Some information we need first: CVI2012 was released in 2012, Windows 8.1 in 2014, Windows 10 afterwards, and CVI2017 in 2017.

 

By looking at the publicly available documentation, especially the version numbers it returns, I take the educated guess that originally, GetWinOSVersion was a wrapper for GetVersionEx/GetVersionExA from Windows SDK. This function was changed/marked deprecated by Microsoft with the release of Windows 8.1 (respectively Visual C ~2013). See e.g. Part1: Overcoming Windows 8.1's deprecation of GetVersionEx and GetVersion APIs.

Therefore, CVI2017 could not rely on this function anymore. It might be using Windows SDK's Version Helper functions now.

 

 

Therefore, I conclude that CVI2017 is behaving correctly. However, it seems that the CVI help page on WinOSVersion is outdated.

 

 

Jabara, is your use of this function limited in any way due to the function reporting back the actual version number now (like "10"), instead of the older, somewhat encoded one ("6.2")?

 

 

Edit: Fixed a typo.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
Message 3 of 6
(2,524 Views)

Hi.  Thanks for your detailed explanation.  I was confused because CVI2017 help still says that Win 10 = major version 6,   but looks that correct number should be 10.

 

I can easily adapt my app for that, but I wanted to be sure before change it. I use this functionality just to decide where to find some local information in Windows Directories.

 

Best Regards.

0 Kudos
Message 4 of 6
(2,506 Views)

Hello jabara,

Thank you for reporting back. Btw, I filed a request with the NI Documentation guys, I hope the help page gets updated with the additional information about the numbers Windows-10-targetted applications see in the release of CVI.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
Message 5 of 6
(2,494 Views)

Excelent. Thank you. 

0 Kudos
Message 6 of 6
(2,475 Views)