Delphi определить ОС

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by RAINUR, 9 Jul 2011.

  1. RAINUR

    RAINUR New Member

    Joined:
    24 May 2010
    Messages:
    151
    Likes Received:
    0
    Reputations:
    0
    Здравствуйте.
    Мне нужно определить ОС на котором запущена программа.
    Нужно определить из Windows Xp, Vista, 2000, 7.
    Вот тут нашел, но там сермерки нет и виста))
    Code:
    function DetectWinVersion : TWinVersion;
    var
      OSVersionInfo : TOSVersionInfo;
    begin
      Result := wvUnknown;                      // Неизвестная версия ОС
      OSVersionInfo.dwOSVersionInfoSize := sizeof(TOSVersionInfo);
      if GetVersionEx(OSVersionInfo)
        then
          begin
            case OSVersionInfo.DwMajorVersion of
              3:  Result := wvNT3;              // Windows NT 3
              4:  case OSVersionInfo.DwMinorVersion of
                    0: if OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT
                       then Result := wvNT4     // Windows NT 4
                       else Result := wv95;     // Windows 95
                    10: Result := wv98;         // Windows 98
                    90: Result := wvME;         // Windows ME
                  end;
              5:  case OSVersionInfo.DwMinorVersion of
                    0: Result := wvW2K;         // Windows 2000
                    1: Result := wvXP;          // Windows XP
                    2: Result := wv2003;        // Windows 2003
                  end;
            end;
          end;
    end;
    
     
  2. sn0w

    sn0w Статус пользователя:

    Joined:
    26 Jul 2005
    Messages:
    1,023
    Likes Received:
    1,309
    Reputations:
    327
    зато есть MSDN
     
    1 person likes this.