Which version of the system is running ?

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 ?

For OSX see:

For Windows see the “Windows Functionality Suite”

[quote=68937:@Karen Atkocius]For OSX see:

For Windows see the “Windows Functionality Suite”[/quote]

Thanks :slight_smile:

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 :slight_smile:

On the Mac, there is also System Profiler, and you can access that pretty easily with the MacSystemProfiler class in MacOSLib.

Looks like apple deprecated Gestalt in 10.8!!!

Apple Gestalt docs

I think the language reference needs an update about that… I bet there is a Lot of RB/Xojo code out there that uses it!

I just tried Dave code : Windows reports the same for Windows 8 and 8.1 : Windows 8 build 9200.

Anything more current for windows? I need to find out < windows 8 to disable Toast notifications.

@Christian Schmitz 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.

WFS had code for things going way back


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

@Norman Palardy seems to have implemented this just today :slight_smile:

Meanwhile you can work around this:

[code] 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[/code]

It returns the same structure such as GetVersionExW of Kernel32.
And… it will report Windows 10 :wink:

I was hoping Xojo implemented a feature and I missed it.

Something easy like:

If WindowsVersion < 8.0 then

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).

  • Karen

Here you go: https://blog./private/xojo/forum/TestOSVersionInfo.xojo_binary_project

I’d like to go back and change all my dropbox links to my own site but alas edit restrictions :frowning:

I’ll see about adding this to the WFS