Articles

Use GetVersionEx procedure with OSVERSIONINFO data structure.

procedure TForm1.Button2Click(Sender: TObject);
var
  Info: TOSVersionInfoA;
begin
  Info.dwOSVersionInfoSize:=sizeof(Info);
  GetVersionEx(Info);
  Label1.Caption:='MajorVersion - '+IntToStr(Info.dwMajorVersion);
  Label2.Caption:='MinorVersion - '+IntToStr(Info.dwMinorVersion);
  Label3.Caption:='BuildNumber - '+IntToStr(Info.dwBuildNumber);
  case Info.dwPlatformID of
    VER_PLATFORM_WIN32s:        Label4.Caption:='Win32 on Windows 3.1';
    VER_PLATFORM_WIN32_WINDOWS: Label4.Caption:='Win32 on Windows 95/98';
    VER_PLATFORM_WIN32_NT:      Label4.Caption:='Win32 on Windows NT';
  end;
end;