zoukankan      html  css  js  c++  java
  • C# 读取计算机CPU,HDD信息

    C# 读取计算机CPU,HDD信息

            public string getCpuInfo() //读取CPU信息
            {
                ManagementClass mobj = new ManagementClass("Win32_Processor");
                ManagementObjectCollection moc = mobj.GetInstances();
                foreach (ManagementObject mo in moc)
                {
                    return mo.Properties["ProcessorId"].Value.ToString();
                }
                return "";
            }
            public string getHddInfo() //读取硬盘信息
            {
                ManagementClass mobj = new ManagementClass("Win32_PhysicalMedia");
                ManagementObjectCollection moc = mobj.GetInstances();
                foreach (ManagementObject mo in moc)
                {
                    return mo.Properties["SerialNumber"].Value.ToString();
                }
                return "";
            }

  • 相关阅读:
    flash 异性窗体
    ASCⅡ 表 关键字符
    VC 中显示位图的步骤
    输出电脑的所有Mac地址
    const char* 和 char* const
    C# 生成PDF
    vc6显示行号
    纪念一下。
    MII接口全家福
    Virtex6 GTX设计总结:预加重、均衡、输出振幅的值
  • 原文地址:https://www.cnblogs.com/zhangchenliang/p/730818.html
Copyright © 2011-2022 走看看