以下代码是我正在使用的,保证有效,其中lblOS是一个LABEL,用以显示版本号:<br><br>var<br> Platform: string;<br> BuildNumber: Integer;<br>begin<br> case Win32Platform of<br> VER_PLATFORM_WIN32_WINDOWS:<br> begin<br> if (Win32MajorVersion=4) and (Win32MinorVersion=10) then<br> Platform :='Windows 98'<br> else<br> Platform := 'Windows 95';<br> BuildNumber := Win32BuildNumber and $0000FFFF;<br> end;<br> VER_PLATFORM_WIN32_NT:<br> begin<br> if (Win32MajorVersion=5) and (Win32MinorVersion=0) then<br> Platform := 'Windows 2000'<br> else if (Win32MajorVersion=5) and (Win32MinorVersion=1) then<br> Platform := 'Windows XP'<br> else if (Win32MajorVersion=4) and (Win32MinorVersion=0) then<br> Platform := 'Windows NT 4.0'<br> else<br> Platform := 'Windows NT'; <br> BuildNumber := Win32BuildNumber;<br> end;<br> else<br> begin<br> Platform := 'Windows';<br> BuildNumber := 0;<br> end;<br> end;<br> if (Win32Platform = VER_PLATFORM_WIN32_WINDOWS) or<br> (Win32Platform = VER_PLATFORM_WIN32_NT) then<br> begin<br> if Win32CSDVersion = '' then<br> lblOS.Caption := lblOS.Caption+Format('%s 版本 %d.%d '+#13+' (内部版本 %d)', [Platform, Win32MajorVersion,<br> Win32MinorVersion, BuildNumber])<br> else<br> lblOS.Caption := lblOS.Caption+Format('%s 版本 %d.%d '+#13+' (内部版本 %d: %s)', [Platform, Win32MajorVersion,<br> Win32MinorVersion, BuildNumber, Win32CSDVersion]);<br> end<br> else<br> lblOS.Caption := lblOS.Caption+Format('%s %d.%d', [Platform, Win32MajorVersion,<br> Win32MinorVersion])<br>end;<br>