On Tuesday, 22 November 2016 at 11:00:52 UTC, Bauss wrote:
On Monday, 21 November 2016 at 09:11:39 UTC, Jonathan M Davis wrote:
On Monday, November 21, 2016 08:57:11 Bauss via Digitalmars-d-learn wrote:
[...]

Phobos doesn't have anything like that, but you can use the C functions from the Windows API to do it. A quick search turned up GetVersion and GetVersionExA/W:

[...]

Thank you, I thought I would end up with something like that! :)

Obtaining the true Windows version is tricky starting with Windows 8.

Be careful when using GetVersionEx, it's deprecated. VerifyVersionInfo is more reliable, but it will not return a version greater than Windows 8 if your application does not embed a specific manifest. The dirty way to obtain the true Windows version without embedding a manifest, it's to check for the availability of specific functions.

Another way is to parse HLKM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Product Name.

And finally NetServerGetInfo is your best bet, but it's not guaranteed to work in the future version of Windows.


Reply via email to