How do you detect Windows version?

Check the API help In the WINPROCS unit try the function GetVersion: LongInt;

The GetVersion function retrieves the current version numbers of the Windows and MS-DOS operation systems.

NOTE: there is a error in the orginal API documentation, the major/minor Win version are reversed!

As I have used it:

Windows 3.1 show up as 3.1, WIN95 shows up as 3.95

Note For windows 95 and higher use the function GetVersionEx