Obtener la version del windows que se esta usando
0000-00-00 00:00:00
function GetWindowsVersion : string; var OsVinfo : TOSVERSIONINFO; HelpStr : array[0..50] of char; begin ZeroMemory(@OsVinfo,sizeOf(OsVinfo)); OsVinfo.dwOSVersionInfoSize := sizeof(TOSVERSIONINFO); if GetVersionEx(OsVinfo) then begin if OsVinfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then begin if (OsVinfo.dwMajorVersion = 4) and (OsVinfo.dwMinorVersion > 0) then StrFmt(HelpStr, 'Windows 98 - Version %d.%.2d.%d', [OsVinfo.dwMajorVersion, OsVinfo.dwMinorVersion, OsVinfo.dwBuildNumber and $FFFF]) else StrFmt(HelpStr, 'Windows 95 - Version %d.%d Build %d', [OsVinfo.dwMajorVersion, OsVinfo.dwMinorVersion, OsVinfo.dwBuildNumber and $FFFF]); end; if OsVinfo.dwPlatformId = VER_PLATFORM_WIN32_NT then StrFmt(HelpStr, 'Microsoft Windows NT Version %d.%.2d.%d', [OsVinfo.dwMajorVersion, OsVinfo.dwMinorVersion, OsVinfo.dwBuildNumber and $FFFF]); end else StrCopy(HelpStr, 'GetversionEx() Error'); Result := string(HelpStr); end; function GetWindowsVersionShort : string; var OsVinfo : TOSVERSIONINFO; begin ZeroMemory(@OsVinfo,sizeOf(OsVinfo)); OsVinfo.dwOSVersionInfoSize := sizeof(TOSVERSIONINFO); if GetVersionEx(OsVinfo) then begin if OsVinfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then Result:='9X'; if OsVinfo.dwPlatformId = VER_PLATFORM_WIN32_NT then Result:='NT'; end else Result := 'Er'; end;
Yo personalmente uso mucho la segunda version, la mas corta, en mis programas.