2009-02-18 55 views

回答

1

另一種選擇是讓的一個網卡的MAC地址在您的系統。這是一個唯一的數字下面的例程獲取第一張網卡的MAC地址,然後將地址中的字節添加到唯一的ulong中(對於C#而不是VB.NET):

 

using System.Net.NetworkInformation; 
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); 
if (nics.Length != 0) 
{ 
    byte[] addressBytes = nics[0].GetPhysicalAddress().GetAddressBytes(); 
    if (addressBytes.Length > 6) 
     throw new ApplicationException("Unexpected length for MAC address"); 

    ulong address = 0; 
    foreach (byte b in addressBytes) 
    { 
     address 
0

您可以使用WMI訪問該信息。

string s = "SELECT SerialNumber FROM WIN32_BaseBoard"; 
System.Management.ManagementObjectSearcher oWMI = new 
System.Management.ManagementObjectSearcher(s); 
System.Management.ManagementObjectCollection oSerialNumbers = oWMI.Get(); 

foreach (System.Management.ManagementObject mo in oSerialNumbers) 
{ 
Console.WriteLine("Serial Number: " + 
mo.Properties["SerialNumber"].Value.ToString()); 
} 

從這裏引用: http://bytes.com/groups/net/411975-how-can-i-get-processor-id-my-computer

又如得到了處理器ID是在這裏: http://www.devasp.net/net/articles/display/149.html

相關問題