This is one of the most commonly asked question: How do you get the Windows version? Well here it is...
Note: if you want the detailed string result such as the version, build number, whether it's 95A, B, C, or 98, etc... see GetWindowsVersionStr().
functionGetWindowsVersion: Word; var VerInfo: TOSVersionInfo; begin VerInfo.dwOSVersionInfoSize := SizeOf(VerInfo); GetVersionEx(VerInfo); Result := VerInfo.dwPlatformID; { The results are as followed: } {case VerInfo.dwPlatformID of VER_PLATFORM_WIN32S: Platform is 'Windows 3.1x running Win32s'; VER_PLATFORM_WIN32_WINDOWS: Platform is 'Windows 95/98'; VER_PLATFORM_WIN32_NT: Platform is 'Windows NT'; end;} end;