Get the Windows 10 build number

  1. 2 weeks ago

    Michel B

    Jan 12 Pre-Release Testers, Xojo Pro

    Sam Rowlands has posted on ohanaware.com a way to get the version and build number for macOS, but I would like to have that as well for Windows.

    Christian, I am sure you have something, but I was not able to find that on your site... Can you help ?

  2. Scott C

    Jan 12 Pre-Release Testers, Xojo Pro twitter.com/ScottCadillac

    Hi Michel, try this SystemInformationMBS and either OSVerstionString or WinBuildNumber.

    I hope that's what you're looking for. Good luck!

  3. Robin L

    Jan 12 Xojo Inc Europe (Germany, Rehlingen)

    You can also check the Registry: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuild or CurrentBuildNumber

    WMI and PowerShell can also access this information.

  4. Robin L

    Jan 12 Xojo Inc Europe (Germany, Rehlingen)

    Here is a useful summary: https://www.tenforums.com/tutorials/23975-find-windows-10-build-number.html

  5. Robin L

    Jan 12 Xojo Inc Europe (Germany, Rehlingen)

    and PowerShell: https://stackoverflow.com/questions/7330187/how-to-find-the-windows-version-from-the-powershell-command-line

  6. Julian S

    Jan 12 Pre-Release Testers, Xojo Pro UK

    You can also get it from kernel32.dll using GetFileVersionInfo and VerQueryValue

    I wrote this a while ago for someone https://www.dropbox.com/s/6v42szgbq0wzc3r/GetFileVersionInfo.xojo_binary_project?dl=0 on the forum.

  7. Javier M

    Jan 13 Xojo Inc, Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store AprendeXojo - Europe, Spain

    You can also use this free class from me . It uses the GetVersionExA function from Kernel32.dll

    It gets major, minor and build numbers. You can get the full string or the structure to pick the desired value.

  8. Sascha S

    Jan 13 Pre-Release Testers, Xojo Pro Germany, Lower Saxony

    @Michel B Christian, I am sure you have something, but I was not able to find that on your site... Can you help ?

    Maybe: SystemInformationMBS.OSVersionString ?

  9. Javier M

    Jan 13 Xojo Inc, Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store AprendeXojo - Europe, Spain

    Just for completion (macOS side). If you need to get the Build version on macOS (you can use System.Version to get the version data on all the supported platforms since 2019r3 for that), then you can parse the string returned by the following code:

    Declare Function NSClassFromString Lib "Foundation" (className As CFStringRef) As ptr
    Var NSClassName As ptr = NSClassFromString("NSProcessInfo")
    Declare Function ProcessInfo Lib "Foundation" selector "processInfo" (cobj As ptr) As ptr
    Var NSProcInfo As ptr = NSProcessInfo( NSClassName )
    Declare Function NSversionString Lib "Foundation" selector "operatingSystemVersionString" ( procInfo As ptr) As CFStringRef
    Return NSversionString( NSProcInfo )
  10. Sascha S

    Jan 13 Pre-Release Testers, Xojo Pro Germany, Lower Saxony

    @SaschaSchneppmueller Maybe: SystemInformationMBS.OSVersionString ?

    Works on all Platforms and gives a String like this: Windows 10 (Build 18362) or Windows Server 2012 R2 (Build 9600)

  11. Jürg O

    Jan 13 Pre-Release Testers, Xojo Pro

    And just to add one more way:
    Get the Shell Output of this command: ver
    It looks like this:

    Microsoft Windows [Version 10.0.18362.535]
  12. Michel B

    Jan 13 Pre-Release Testers, Xojo Pro

    Whao! I am elated to see so many great answers.

    Thank you so much to all.

    I have more than enough to implement, now.

  13. Javier M

    Jan 14 Xojo Inc, Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store AprendeXojo - Europe, Spain

    AXOSVersion Class (free): enhanced to support both macOS / Windows, giving access to every value (major, minor and build version) and the combined String.

    Hope it helps!

    Javier

  14. Michel B

    Jan 14 Pre-Release Testers, Xojo Pro
    Edited 2 weeks ago

    Actually, I have already implemented the MBS solution in both Mac and Windows.

    In Windows, I was chasing a nasty intermittent bug that manifested sometimes at lauch, and I could not figure what was going on.

    I then decided to present the user with a window, just like macOS does, showing the stack, and asking permission to send in order to help. I then sent by HTTPSocket to a web service. With the complete information about system version.

    Lo and Behold, I received almost immediately a report, as soon as the new version was released.

    I was testing the presence of a keyboard by taping into the Registry. I assumed all version of Windows had that key. How was I wrong: trying to access a key that is not there triggered a nil object exception. The one I had been chasing for now six months or so.

    Version 3.82 will be on it's way this afternoon, without the random bug :)

or Sign Up to reply!