c# 检测32/64系统
2012-03-26 14:55
190 查看
private int Detect3264()
{
ConnectionOptions oConn = new ConnectionOptions();
ManagementScope oMs = new ManagementScope("\\\\localhost", oConn);
ObjectQuery oQuery = new ObjectQuery("select AddressWidth from Win32_Processor");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
string addressWidth = null;
foreach (ManagementObject oReturn in oReturnCollection)
{
addressWidth = oReturn["AddressWidth"].ToString();
}
return Convert.ToInt32(addressWidth);
}
最后别忘添加引用System.Management
{
ConnectionOptions oConn = new ConnectionOptions();
ManagementScope oMs = new ManagementScope("\\\\localhost", oConn);
ObjectQuery oQuery = new ObjectQuery("select AddressWidth from Win32_Processor");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
string addressWidth = null;
foreach (ManagementObject oReturn in oReturnCollection)
{
addressWidth = oReturn["AddressWidth"].ToString();
}
return Convert.ToInt32(addressWidth);
}
最后别忘添加引用System.Management
相关文章推荐
- win10 64系统如何换成win7 32系统?
- VT-x/AMD-V 硬件加速在您的系统中不可用。您的 64-位虚拟机将无法检测到 64-位处理器,从而无法启动。
- C#检测本机是否联网 调用系统函数
- 【BETA】Mac技巧之查看苹果电脑 Mac OS X 系统是否开启 64 位运算,以及设置 32/64 位模式的方法
- linux如何查看系统是多少位的?64 OR 32
- C# 如果在安装 32 位 Oracle 客户端组件的情况下以 64 位模式运行
- C#检测系统无操作时间与关闭计算机
- Error:CreateProcess error=216, 该版本的 %1 与您运行的 Windows 版本不兼容。请查看计算机的系统信息,了解是否需要 x86 (32 位)或 x64 (64 位)
- linux查看内核版本、系统版本、系统位数(32/64)
- <转>查看linux系统位数方法(32?64?)
- win7 64系统,检测有没有装SP1补丁!
- Error:CreateProcess error=216, 该版本的 %1 与您运行的 Windows 版本不兼容。请查看计算机的系统信息,了解是否需要 x86 (32 位)或 x64 (64 位)
- python检测windows系统是32还是64位
- Python中maxint与系统位数(32/64)的关系
- 查看linux系统是32还是64
- Mac技巧之查看苹果电脑 Mac OS X 系统是否开启 64 位运算,以及设置 32/64 位模式的方法
- Error:CreateProcess error=216, 该版本的 %1 与您运行的 Windows 版本不兼容。请查看计算机的系统信息,了解是否需要 x86 (32 位)或 x64 (64 位)
- VS2015 C#生成dll文件的方法(32/64)
- 查看linux系统位数方法(32?64?)
- VS中MFC连接MySQL由于系统不同位(32/64)引起的错误:无法解析的外部符号 _mysql_init@4、_mysql_query