Is there a way to know which version of the system the user is running on ? For instance, Mac OS 10.7 or Mavericks ? Windows Vista or Windows 8.1 ?
Dave posted some code here too: https://forum.xojo.com/2239-how-to-determine-os-which-version-and-which-ver-of-windoz
@Albin K Dave posted some code here too: https://forum.xojo.com/2239-how-to-determine-os-which-version-and-which-ver-of-windoz
Great ! The Windows code is cool. Thank you :)
Anything more current for windows? I need to find out < windows 8 to disable Toast notifications.
@ChristianSchmitz Maybe the Winusernotification plugin should have code in it to prevent crashing when run on windows 7.
Edit: Sorry an exception is raised. I just wasn't handling it. No crash.
@Neil B Anything more current for windows?
Windows reports the same for Windows 8 and 8.1 : Windows 8 build 9200.
Keep that in mind... Those "old" code snipplets may return Windows 8 instead of 10.
The reason is that Application that haven't declared support for Windows 8.1, 10 in the Application's manifest always return 8.
See: Targeting your application for Windows
In Windows 8.1 and Windows 10, the GetVersion and GetVersionEx functions have been deprecated. In Windows 10, the VerifyVersionInfo function has also been deprecated. While you can still call the deprecated functions, if your application does not specifically target Windows 8.1 or Windows 10, you will get Windows 8 version (188.8.131.52).
Meanwhile you can work around this:
Soft Declare Function RtlGetVersion lib "ntdll.dll" (info as Ptr ) As Integer if (iMajorVersion = 6) and (iMinorVersion = 2) then 'We got Windows 8. However, because we don't have a ManiFest it might be Windows 10. 'So let's see what we get here if System.IsFunctionAvailable( "RtlGetVersion", "ntdll.dll" ) then iSPOffset = 20 + (2 * 128) info = new MemoryBlock( iSPOffset + 6 + 2) info.Long( 0 ) = info.Size if (RtlGetVersion( info ) = 0) then 'STATUS_SUCCESS = 0 iMajorVersion = info.Long( 4 ) iMinorVersion = info.Long( 8 ) iBuildNumber = info.Long( 12 ) iPlatformID = info.Long( 16 ) sServicePack = info.WString( 20 ) iServicePackMajor = info.Int16Value( iSPOffset ) iServicePackMinor = info.Int16Value( iSPOffset + 2) iSuiteMask = info.Int16Value( iSPOffset + 4) iProductType = info.Byte( iSPOffset + 6) end if end if
It returns the same structure such as GetVersionExW of Kernel32.
And... it will report Windows 10 ;)
Further to Jurg's post above, I wrote this for discord, might as well leave a link here if anyone needs it. Its using RtlGetVersion with the OSVERSIONINFOEXW structure defined. This isn't affected by manifests as call using GetVersionExW are.
Sorry for bringing up this old thread but I was looking for a way to get Windows Version Info and I came upon this... I can't look at the code as drop-box is blocked for me from work but I will when i get home.
But to make getting the Windows version more accessible (and easily findable), maybe someone could update the Windows Functionality Suite on Github to get the correct Windows OS version info for window these days and maybe save the WFS in a more modern version of Xojo - the files still use REAlBasic endings (maybe export from 2019R1).
I'd like to go back and change all my dropbox links to my own site but alas edit restrictions :(
I'll see about adding this to the WFS