• 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 "";
            }
         //取得设备硬盘的卷标号
            public string GetDiskVolumeSerialNumber()
            {
                ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
                ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid="d:"");
                disk.Get();
                return disk.GetPropertyValue("VolumeSerialNumber").ToString();
            }
            //获得CPU的序列号
            public string getCpu()
            {
                string strCpu = null;
                ManagementClass myCpu = new ManagementClass("win32_Processor");
                ManagementObjectCollection myCpuConnection = myCpu.GetInstances();
                foreach (ManagementObject myObject in myCpuConnection)
                {
                    strCpu = myObject.Properties["Processorid"].Value.ToString();
                    break;
                }
                return strCpu;
            }       
    
  • 相关阅读:
    js 多物体运动
    js运动 淡入淡出
    js运动 分享到
    正则 重复项最多得子项
    jq 拖拽
    jq 弹出窗口
    jq 选项卡
    jq 写法
    Codeforces 185A Plant( 递推关系 + 矩阵快速幂 )
    HDU 2604 Queuing( 递推关系 + 矩阵快速幂 )
  • 原文地址:https://www.cnblogs.com/ziranquliu/p/4690672.html
Copyright © 2020-2023  润新知