Yo tengo lo mismo pero sin tener que preguntar cada vez, si la versión es XP, es tal o cual, las dos funciones te devuelven la version de Windows que tengas
Código Delphi
[-]
function GetOSVersion : Integer;
var
osVerInfo : TOSVersionInfo;
majorVer, minorVer : Integer;
begin
osVerInfo.dwOSVersionInfoSize := SizeOf( TOSVersionInfo );
if ( GetVersionEx( osVerInfo ) ) then begin
majorVer := osVerInfo.dwMajorVersion;
minorVer := osVerInfo.dwMinorVersion;
case ( osVerInfo.dwPlatformId ) of
VER_PLATFORM_WIN32_NT : begin
if ( majorVer <= 4 ) then Result := cOsWinNT
else
if ( ( majorVer = 5 ) and ( minorVer= 0 ) ) then Result := cOsWin2000
else
if ( ( majorVer = 5) and ( minorVer = 1 ) ) then Result := cOsWinXP
else Result := cOsUnknown;
end;
VER_PLATFORM_WIN32_WINDOWS : begin
if ( ( majorVer = 4 ) and ( minorVer = 0 ) ) then Result := cOsWin95
else
if ( ( majorVer = 4 ) and ( minorVer = 10 ) ) then begin
if ( osVerInfo.szCSDVersion[ 1 ] = 'A' ) then Result := cOsWin98SE
else Result := cOsWin98;
end
else
if ( ( majorVer = 4) and ( minorVer = 90 ) ) then Result := cOsWinME
else Result := cOsUnknown;
end;
else Result := cOsUnknown;
end;
end else Result := cOsUnknown;
end;
function GetOSName( OSCode : Integer ) : String;
begin
if ( OSCode = cOsUnknown ) then Result := '(Desconocido)'
else if ( OSCode = cOsWin95 ) then Result := 'Microsoft Windows 95'
else if ( OSCode = cOsWin98 ) then Result := 'Microsoft Windows 98'
else if ( OSCode = cOsWin98SE ) then Result := 'Microsoft Windows 98 Segunda Edicion'
else if ( OSCode = cOsWinME ) then Result := 'Microsoft Windows Millennium Edition'
else if ( OSCode = cOsWinNT ) then Result := 'Microsoft Windows NT'
else if ( OSCode = cOsWin2000 ) then Result := 'Microsoft Windows 2000'
else if ( OSCode = cOsWinXP ) then Result := 'Microsoft Windows XP'
else Result := 'Microsoft Windows';
end;