怎样判断windows的版本是否是xp??(100分)

  • 主题发起人 主题发起人 www
  • 开始时间 开始时间
W

www

Unregistered / Unconfirmed
GUEST, unregistred user!
只需要判断是否xp
 
用GetVersionEx函数,至于怎么用,去查DELPHI的帮助吧.
 
var
OSVI:OSVERSIONINFO;
begin
OSVI.dwOSversioninfoSize:=Sizeof(OSVERSIONINFO);
GetVersionEx(OSVI);
if OSVI.dwMajorVersion=5 and OSVI.dwMinorVersion=1 then
begin
......
end;
end;
 
function GetWindowsVersion: string;
var
// windows api structure
VersionInfo: TOSVersionInfo;
begin
// get size of the structure
VersionInfo.dwOSVersionInfoSize := SizeOf(VersionInfo);
// populate the struct using api call
GetVersionEx(VersionInfo);
// platformid gets the core platform
// major and minor versions also included.
with VersionInfo do
begin
case dwPlatformid of
0 : begin
result := 'Windows 3.11';
end; // end 0

1 : begin
case dwMinorVersion of
0 : result := 'Windows 95';
10: begin
if ( szCSDVersion[ 1 ] = 'A' ) then
Result :='Windows 98 SE'
else
Result := 'Windows 98';
end; // end 10
90 : result := 'Windows Millenium';
else
result := 'Unknown Version';
end; // end case
end; // end 1

2 : begin
case dwMajorVersion of
3 : result := 'Windows NT ' +
IntToStr(dwMajorVersion) + '.' +
IntToStr(dwMinorVersion);
4 : result := 'Windows NT ' +
IntToStr(dwMajorVersion) + '.' +
IntToStr(dwMinorVersion);
5 : begin
case dwMinorVersion of
0 : result := 'Windows 2000';
1 : result := 'Windows XP';
end; // end case
end; // end 5
else
result := 'Unknown Version';
end; // end case
// service packs apply to the NT/2000 platform
if szCSDVersion <> '' then
result := result + ' Service pack: ' + szCSDVersion;
end; // end 2
else
result := 'Unknown Platform';
end; // end case
// add build info.
result := result + ', Build: ' +
IntToStr(Loword(dwBuildNumber)) ;
end; // end version info
end; // GetWindowsVersion

 
多人接受答案了。
 
后退
顶部