In SysUtils, there is a handy function (CheckWin32Version) to check that you are running at least a certain version of Windows. Unfortunately, it is wrong. For example, let's say you want to make sure you are running Win2000 or greater. The following code should do just that:
if CheckWin32Version(5) then
When running on XP, the major version will be 5, and the minor version will be 1. These are stored in writable constants in SysUtils. Inside CheckWin32Version, the check for AMinor is backwards, so your results will be wrong.
I am now using this function instead and everything works fine:
function FixedCheckWin32Version(AMajor: Integer; AMinor: Integer = 0): Boolean;
Result := (AMajor < Win32MajorVersion) or
((AMajor = Win32MajorVersion) and
(AMinor <= Win32MinorVersion));
Just a side-note: This was fixed in Delphi 7 and above. Of course, if you're using D6, you'll need to use this.