Which version of the system is running ?

  1. 6 years ago

    Michel B

    3 Mar 2014 Pre-Release Testers, Xojo Pro

    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:
    http://docs.xojo.com/index.php/System.Gestalt

    For Windows see the "Windows Functionality Suite"

  2. Karen A

    3 Mar 2014 Pre-Release Testers Answer

    For OSX see:
    http://docs.xojo.com/index.php/System.Gestalt

    For Windows see the "Windows Functionality Suite"

  3. Michel B

    3 Mar 2014 Pre-Release Testers, Xojo Pro

    @Karen A For OSX see:
    http://docs.xojo.com/index.php/System.Gestalt

    For Windows see the "Windows Functionality Suite"

    Thanks :)

  4. Albin K

    3 Mar 2014 Europe (Sweden)

    Dave posted some code here too: https://forum.xojo.com/2239-how-to-determine-os-which-version-and-which-ver-of-windoz

  5. Michel B

    3 Mar 2014 Pre-Release Testers, Xojo Pro

    @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 :)

  6. Kem T

    3 Mar 2014 Pre-Release Testers, Xojo Pro, XDC Speakers Connecticut

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

  7. Karen A

    3 Mar 2014 Pre-Release Testers

    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!

  8. Michel B

    3 Mar 2014 Pre-Release Testers, Xojo Pro

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

  9. 2 years ago

    Neil B

    9 Sep 2017 Pre-Release Testers
    Edited 2 years ago

    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.

  10. Norman P

    9 Sep 2017 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...

    WFS had code for things going way back

  11. Neil B

    9 Sep 2017 Pre-Release Testers

    Thanks

  12. Jürg O

    9 Sep 2017 Pre-Release Testers, Xojo Pro
    Edited 2 years ago

    @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 (6.2.0.0).

    Feedback Case #43702
    @Norman P seems to have implemented this just today :)

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

  13. Neil B

    9 Sep 2017 Pre-Release Testers

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

    Something easy like:

    If WindowsVersion < 8.0 then
  14. 4 months ago

    Julian S

    Jul 6 Pre-Release Testers, Xojo Pro UK

    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.

    https://www.dropbox.com/s/v76v1fiho7w2zwa/TestOSVersionInfo.xojo_binary_project?dl=0

  15. 6 weeks ago

    Karen A

    Oct 9 Pre-Release Testers

    @Julian S https://www.dropbox.com/s/v76v1fiho7w2zwa/TestOSVersionInfo.xojo_binary_project?dl=0

    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

  16. Julian S

    Oct 9 Pre-Release Testers, Xojo Pro UK

    Here you go: https://blog.samphire.net/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 :(

    I'll see about adding this to the WFS

or Sign Up to reply!