گرفتن نام سيستم عامل

گرفتن نام سيستم عامل (۹۸ - XP.....

unit WVersion; interface uses Windows, SysUtils; function GetWindowsVersion: String; implementation function GetWindowsVersion: String; const cOsUnknown : Integer = -1; cOsWin95 : Integer = 0; cOsWin98 : Integer = 1; cOsWin98SE : Integer = 2; cOsWinME : Integer = 3; cOsWinNT : Integer = 4; cOsWin2000 : Integer = 5; cOsWinXP : Integer = 6; var osVerInfo : TOSVersionInfo; majorVer, minorVer, VersionCode: 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 : { Windows NT/2000/XP }  begin  if ( majorVer <= 4 ) then VersionCode := cOsWinNT else  if ( ( majorVer = 5 ) and ( minorVer= 0 ) ) then VersionCode := cOsWin2000 else  if ( ( majorVer = 5) and ( minorVer = 1 ) ) then VersionCode := cOsWinXP else VersionCode := cOsUnknown; end; VER_PLATFORM_WIN32_WINDOWS : { Windows 9x/ME }  begin  if ( ( majorVer = 4 ) and ( minorVer = 0 ) ) then VersionCode := cOsWin95 else  if ( ( majorVer = 4 ) and ( minorVer = 10 ) ) then  begin  if ( osVerInfo.szCSDVersion[ 1 ] = 'A' ) then VersionCode := cOsWin98SE else VersionCode := cOsWin98; end  else  if ( ( majorVer = 4) and ( minorVer = 90 ) ) then VersionCode := cOsWinME else VersionCode := cOsUnknown; end; else VersionCode := cOsUnknown; end; { Final del Case}  end  else VersionCode := cOsUnknown; {Final del if}  if ( VersionCode = cOsUnknown ) then Result := '(sistema no reconocido)'  else if ( VersionCode = cOsWin95 ) then Result := 'Microsoft Windows 95'  else if ( VersionCode = cOsWin98 ) then Result := 'Microsoft Windows 98'  else if ( VersionCode = cOsWin98SE ) then Result := 'Microsoft Windows 98 Second Edition'  else if ( VersionCode = cOsWinME ) then Result := 'Microsoft Windows Millennium Edition'  else if ( VersionCode = cOsWinNT ) then Result := 'Microsoft Windows NT'  else if ( VersionCode = cOsWin2000 ) then Result := 'Microsoft Windows 2000'  else if ( VersionCode = cOsWinXP ) then Result := 'Microsoft Windows XP'  else Result := 'Microsoft Windows'; Result:= Result + ' (Build '+IntToStr(osVerInfo.dwBuildNumber)+') ' + osVerInfo.szCSDVersion; end; end.

/ 0 نظر / 30 بازدید