Jump to content
robertjohns

Getting Win 11 in Delphi

Recommended Posts

Using TOSVersion:

IsWindows11 := (TOSVersion.Major = 10) and (TOSVersion.Minor = 0) and (TOSVersion.Build >= 22000);

(At least until Windows 12?)

Where IsWindows11 is a Boolean.

Share this post


Link to post

I don't understand the question. On my Windows 11 laptop, TOSVersion.ToString returns

Windows 11 (Version 22H2, OS Build 22621.2715, 64-bit Edition)

You could look at TOSVersion.Create in System.SysUtils.pas.

 

TOSVersion.Name should also return "Windows 11"

Edited by JonRobertson
  • Like 1

Share this post


Link to post
30 minutes ago, JonRobertson said:

I don't understand the question. On my Windows 11 laptop, TOSVersion.ToString returns


Windows 11 (Version 22H2, OS Build 22621.2715, 64-bit Edition)

You could look at TOSVersion.Create in System.SysUtils.pas.

 

TOSVersion.Name should also return "Windows 11"

but on my system TOSVersion.ToString returns Windows 10

Share this post


Link to post

The string "Windows 10" or "Windows 11" does not come from the Windows API, it is a string hardcoded into the Delphi RTL (System.RTLConsts.pas).

 

Delphi 10.2 is from 2017. Windows 11 was released 2021.

 

  • Like 1

Share this post


Link to post

HKLM\Software\Microsoft\Windows NT\CurrentVersion

ProductName: REG_SZ

 

On my Windows 10 pro it says "Windows 10 pro".

There are several other entries that might be of interest, e.g. DisplayVersion="22H2".

 

Of course this can easily be manipulated by an administratorl

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×