반응형
type TWindowsVersion = ( wvUnknow, wvWin31, wvWin9x, wvWin95, wvWin95OSR2, wvWin98, wvWin98SE, wvWinMe, wvWinNT, wvWinNT3, wvWinNT4, wvWin2000, wvWinXP, wvWin2003, wvWinVista, wvWin7 ); function GetWindowsVersion(var WindowsName: String): TWindowsVersion; var VI: TOSVersionInfo; WinVersion: TWindowsVersion; begin VI.dwOSVersionInfoSize := SizeOf(VI); GetVersionEx(VI); WinVersion := wvUnknow; case VI.dwPlatformID of VER_PLATFORM_WIN32s: WinVersion := wvWin31; VER_PLATFORM_WIN32_WINDOWS : begin case VI.dwMinorVersion of 0 : begin if Trim(VI.szCSDVersion[1]) = 'B' then WinVersion := wvWin95OSR2 else WinVersion := wvWin95; end; 10 : begin if Trim(VI.szCSDVersion[1]) = 'A' then WinVersion := wvWin98SE else WinVersion := wvWin98; end; 90 : begin if (VI.dwBuildNumber = 73010104) then WinVersion := wvWinMe; end; else WinVersion := wvWin9x; end; end; VER_PLATFORM_WIN32_NT : begin case VI.dwMajorVersion of 3 : WinVersion := wvWinNT3; 4 : WinVersion := wvWinNT4; 5 : begin case VI.dwMinorVersion of 0 : WinVersion := wvWin2000; 1 : WinVersion := wvWinXP; 2 : WinVersion := wvWin2003; else WinVersion := wvWinNT; end; end; 6 : begin case VI.dwMinorVersion of 0 : WinVersion := wvWinVista; 1 : WinVersion := wvWin7; end; end; end; end; end; case WinVersion of wvUnknow : WindowsName := 'Unknow'; wvWin31 : WindowsName := 'Win31'; wvWin9x : WindowsName := 'Win9x'; wvWin95 : WindowsName := 'Win95'; wvWin95OSR2 : WindowsName := 'Win95R2'; wvWin98 : WindowsName := 'Win98'; wvWin98SE : WindowsName := 'Win98SE'; wvWinMe : WindowsName := 'WinME'; wvWinNT : WindowsName := 'WinNT'; wvWinNT3 : WindowsName := 'WinNT3'; wvWinNT4 : WindowsName := 'WinNT4'; wvWin2000 : WindowsName := 'Win2000'; wvWinXP : WindowsName := 'WinXP'; wvWin2003 : WindowsName := 'Win2003'; wvWinVista : WindowsName := 'WinVista'; wvWin7 : WindowsName := 'Win7'; end; end;
반응형
'Programming > Delphi' 카테고리의 다른 글
[Local DB] NexusDB (0) | 2011.01.12 |
---|---|
E2220:Never-build package '%s' requires always-build package '%s' (0) | 2011.01.11 |
로컬 아이피 알아내기 (0) | 2010.12.16 |
파일 버전 알아내기 (0) | 2010.12.16 |
현재 떠있는 익스플로러 타이틀과 URL 가져오기 (0) | 2010.12.16 |