我正在使用此代码来检测 PC 上的 WindowsVersion。
function GetOS: string;
var
osVerInfo: TOSVersionInfo;
majorVer, minorVer: Integer;
begin
Result := 'Unknown';
osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(osVerInfo) then
begin
majorVer := osVerInfo.dwMajorVersion;
minorVer := osVerInfo.dwMinorVersion;
case osVerInfo.dwPlatformId of
VER_PLATFORM_WIN32_NT: {Mirosoft Windows NT/2000 }
begin
if majorVer <= 4 then
Result := 'Win NT'
else if (majorVer = 5) and (minorVer = 0) then
Result := 'Win 2k'
else if (majorVer = 5) and (minorVer = 1) then
Result := 'Win XP'
else if (majorVer = 6) and (minorVer = 0) then
Result := 'Win Vista'
else if (majorVer = 6) and (minorVer = 1) then
Result := 'Win 7'
else if (majorVer = 6) and (minorVer = 2) then
Result := 'Win 8'
end;
VER_PLATFORM_WIN32_WINDOWS: { Windows 9x/ME }
begin
if (majorVer = 4) and (minorVer = 0) then
Result := 'Win 95'
else if (majorVer = 4) and (minorVer = 10) then
begin
if osVerInfo.szCSDVersion[1] = 'A' then
Result := 'Win 98SE'
else
Result := 'Win 98';
end
else if (majorVer = 4) and (minorVer = 90) then
Result := 'Win ME'
end;
end;
end;
end;
出于某种原因,它说 Windows8 Consumer Preview Build 8250(32 位)是 Windows XP - 主要版本 5。我检查了它应该是版本 6.2(根据 windows8 上的 notepad.exe)这是一个错误还是有什么问题?顺便提一句。我的 Windows 8 已更新。
有任何想法吗?
编辑:截图