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 ?
Here is a useful summary: https://www.tenforums.com/tutorials/23975-find-windows-10-build-number.html
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.
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.
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 )
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 :)