c# 判断系统32位还是64位
来源:互联网 发布:国际网络公开课 编辑:程序博客网 时间:2024/06/01 09:54
判断系统是否是64位的方法有很多。
对于C#来说,调用WMI是一种简单易行的方式。我们可以用Win32_Processor类里面的AddressWidth属性来表示系统的位宽。AddressWidth的值受CPU和操作系统的双重影响。
具体的值如下面的表格所示:
可以用下面的C#代码得到AddressWidth的值
(注意需添加引用System.Management)
public static string Detect3264()
{
ConnectionOptions oConn =new ConnectionOptions();
System.Management.ManagementScope oMs =new System.Management.ManagementScope("\\\\localhost", oConn);
System.Management.ObjectQuery oQuery =new System.Management.ObjectQuery("select AddressWidth from Win32_Processor");
ManagementObjectSearcher oSearcher =new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
string addressWidth = null;
foreach (ManagementObject oReturnin oReturnCollection)
{
addressWidth = oReturn["AddressWidth"].ToString();
}
return addressWidth;
}
{
ConnectionOptions oConn =new ConnectionOptions();
System.Management.ManagementScope oMs =new System.Management.ManagementScope("\\\\localhost", oConn);
System.Management.ObjectQuery oQuery =new System.Management.ObjectQuery("select AddressWidth from Win32_Processor");
ManagementObjectSearcher oSearcher =new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
string addressWidth = null;
foreach (ManagementObject oReturnin oReturnCollection)
{
addressWidth = oReturn["AddressWidth"].ToString();
}
return addressWidth;
}
- C#判断系统是32位还是64位
- c# 判断系统32位还是64位
- C# 如何判断系统是32位还是64位
- C#判断操作系统是32位还是64位
- C#判断机器是32位还是64位
- VC判断系统是64位还是32位
- delphi判断windows系统是64位还是32位
- 如何判断LINUX系统是64位还是32位
- 判断是否UEFI系统,32位还是64位?
- 判断系统是32位还是64位
- mak 系统是64位还是32位判断程序
- 判断系统是32位还是64位
- 判断系统是32位还是64位
- 判断Linux系统是32位还是64位
- 怎么判断mac系统是32位还是64位
- 判断系统是32位还是64位
- c# 检查系统是32位还是64位
- Linux判断CPU是32位还是64位,判断系统是32位还是64位
- 深入理解Android Sensor系统 (4.0)
- 关于在macosx 封装静态库的简摘
- Concurrency Hazards: False Sharing
- 十、窗口
- Fragments (Android官方文档中文版)
- c# 判断系统32位还是64位
- 一个是阆苑仙葩,一个是美玉无瑕
- 用SpringSource Tool Suite 开发OSGI——(第二步:工程篇)
- forword redirect 区别
- 为C# Windows服务添加安装程序
- 十一、消息对话框
- sqlite数据库的使用
- Socket VS Remoting VS WebService对比
- 开源项目之金山卫士