C++ Builder 参考手册 ➙ System::Sysutils ➙ CheckWin32Version
操作系统的版本是否大于等于参数给定的值。
头文件:#include <System.SysUtils.hpp>
命名空间:System::Sysutils
函数原型:
bool __fastcall CheckWin32Version(int AMajor, int AMinor = 0);
参数:
- AMajor:操作系统主版本号;
- AMinor:操作系统次版本号;
返回值:
- true:操作系统版本大于等于参数给定的值;
- false:操作系统版本小于参数给定的值。
操作系统 | 版本号 |
---|---|
Windows 11 | 10.0 * |
Windows 10 | 10.0 |
Windows 8.1 | 6.3 |
Windows Server 2012 R2 | 6.3 |
Windows 8 | 6.2 |
Windows Server 2012 | 6.2 |
Windows 7 | 6.1 |
Windows Server 2008 R2 | 6.1 |
Windows Server 2008 | 6.0 |
Windows Vista | 6.0 |
Windows Server 2003 R2 | 5.2 |
Windows Server 2003 | 5.2 |
Windows XP | 5.1 |
Windows 2000 | 5.0 |
Windows ME | 4.90 |
Windows NT 4 | 4.0 |
Windows 9x | 4.0 |
Windows NT 3.51 | 3.51 |
Windows NT 3.5 | 3.5 |
* Windows 11 目前还没发布正式版本,Insider Preview 版本一直是 10.0,正式版也没有升级版本号的迹象
例:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(!CheckWin32Version(6,0))
{
ShowMessage(L"需要 Vista 及更新的操作系统运行!");
return;
}
ShowMessage(L"操作系统满足要求。");
}
相关:
- System::Sysutils::Win32MajorVersion
- System::Sysutils::Win32MinorVersion
- System::Sysutils::Win32BuildNumber
- System::Sysutils::Win32CSDVersion
- System::Sysutils::Win32Platform
- System::Sysutils::RaiseLastOSError
- System::Sysutils::CheckOSError
- System::Sysutils::Win32Check
- System::Sysutils::ShowException
- System::Sysutils::ExceptionErrorMessage
- System::Sysutils::OutOfMemoryError
- System::Sysutils::Abort
- System::Sysutils::EAbort
- System::Sysutils
- Vcl::Forms::TApplication::ShowException
C++ Builder 参考手册 ➙ System::Sysutils ➙ CheckWin32Version