国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
C#獲取CPU的序列號、硬盤序列號、網(wǎng)卡序列號等系統(tǒng)相關信息

測試環(huán)境:Visual Studio 2008 (此環(huán)境下通過測試)

方法一:

//獲取cpu信息
public static void GetCpuIndex()
{
            string _cpuInfo = "";
            ManagementClass cimobject = new ManagementClass("Win32_Processor");
            ManagementObjectCollection moc = cimobject.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                _cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
            }
            return _cpuInfo;
}

// 得到硬盤序列號
public static void GetHDIndex()
{
            string _HDInfo = "";
            ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
            ManagementObjectCollection moc1 = cimobject1.GetInstances();
            foreach (ManagementObject mo in moc1)
            {
                _HDInfo = (string)mo.Properties["Model"].Value;


            }
            retrun _HDInfo;
}

//獲取網(wǎng)卡硬件地址
public static void GetMacAddress()
{
            string _MacAddress = "";
            ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
            ManagementObjectCollection moc2 = mc.GetInstances();
            foreach (ManagementObject mo in moc2)
            {
                if ((bool)mo["IPEnabled"] == true)
                    MacAddress = mo["MacAddress"].ToString();
                mo.Dispose();
            }
           
            return _MacAddress;
}

方法二:主要是通過WMI方法獲取系統(tǒng)的相關信息。

具體有關常用WMI的使用列表,本人早已經(jīng)整理到蒂強網(wǎng)絡中了請訪問:

http://www.hd1204.com/article/html/1559.html

//獲取CPU的相關信息
                    ManagementObjectSearcher searcher02 = new ManagementObjectSearcher("select * from Win32_Processor");
                    string strCPUN = "";
                    string strCPUDp = "";
                    string strCPUCCS = "";
                    string strCPUMCS = "";
                    string strCPUMf = "";
                    string strCPUEC = "";
                    string strCPUFy = "";
                    string strCPUL2CS = "";
                    string strCPUNLP = "";
                    string strCPUPId = "";
                    string strCPUPLP = "";

                    foreach (ManagementObject Pror in searcher02.Get())  //調用ManagementObject類GET方法

//獲取CPU的信息
                    {
                        strCPUN = Pror["Name"].ToString().Trim(); //CPU的規(guī)格
                        strCPUDp = Pror["Description"].ToString().Trim(); //CPU的版本
                        strCPUCCS = Pror["CurrentClockSpeed"].ToString().Trim(); //CPU的主頻
                        strCPUMCS = Pror["MaxClockSpeed"].ToString().Trim(); //CPU的最大頻率(高頻)
                        strCPUMf = Pror["Manufacturer"].ToString().Trim(); //CPU的廠商
                        strCPUEC = Pror["ExtClock"].ToString().Trim(); //CPU的前端總線
                        strCPUFy = Pror["NumberOfCores"].ToString().Trim(); //CPU的核心數(shù)
                        strCPUL2CS = Pror["L2CacheSize"].ToString().Trim(); //CPU的二級緩存
                        strCPUNLP = Pror["NumberOfLogicalProcessors"].ToString().Trim(); //CPU邏輯核心個數(shù)
                        strCPUPId = Pror["ProcessorId"].ToString().Trim(); //CPU序列號
                        strCPUPLP = Pror["LoadPercentage"].ToString().Trim(); //CPU使用率
                        break;
                    }

                    //此處本人用Label顯示了cpu的相關信息,這樣顯得更直觀一些!
                    label1.Text = strCPUN;//顯示CPU的規(guī)格   
                    label2.Text = strCPUDp;//顯示CPU的版本
                    label3.Text = strCPUCCS + " " + "MHz";//顯示CPU的主頻
                    label4.Text = strCPUMCS + " " + "MHz";//顯示CPU的最高頻率
                    label5.Text = strCPUMf;//顯示CPU的廠商
                    label6.Text = strCPUL2CS + " " + "KB";//顯示CPU的二級緩存
                    label7.Text = strCPUEC + " " + "MHz";//顯示CPU的前端總線
                    label8.Text = strCPUFy + " " + "個";//顯示CPU的核心數(shù)
                    label9.Text = strCPUNLP + " " + "個";//顯示CPU的邏輯處理器數(shù)
                    label10.Text = strCPUPId;//顯示CPU的序列號
                    label11.Text = strCPUPLP + " " + "%";//顯示CPU使用率
                  
                }

本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
c#如何獲得cpu,硬盤的物理序列號-程序開發(fā)-紅黑聯(lián)盟
獲取cpu序列號,硬盤ID,網(wǎng)卡MAC地址
Winform中實現(xiàn)根據(jù)CPU和硬盤獲取機器碼
C#獲取CPU機器碼并轉換成10進制
C#取硬盤、CPU、主板、網(wǎng)卡的序號 ManagementObjectSearcher
C# 軟件 注冊碼 源碼
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服