cách lấy địa chỉ MAC từ Windows-mobile bằng mã C#?cách lấy địa chỉ MAC từ Windows-mobile?
cảm ơn trước
cách lấy địa chỉ MAC từ Windows-mobile bằng mã C#?cách lấy địa chỉ MAC từ Windows-mobile?
cảm ơn trước
xin vui lòng đi qua liên kết bên dưới dán hy vọng điều này sẽ giúp bạn tìm địa chỉ MAC của thiết bị
MAC address in Compact Framework
How to Get MAC address programatically in c# for a windows mobile 6.0 device
[DllImport("iphlpapi.dll", SetLastError = true)]
public static extern int GetAdaptersInfo(byte[] info, ref uint size);
/// <summary>
/// Gets the Mac Address
/// </summary>
/// <returns>the mac address or ""</returns>
public static unsafe string GetMacAddress()
{
uint num = 0u;
GetAdaptersInfo(null, ref num);
byte[] array = new byte[(int)((UIntPtr)num)];
int adaptersInfo = GetAdaptersInfo(array, ref num);
if (adaptersInfo == 0)
{
string macAddress = "";
int macLength = BitConverter.ToInt32(array, 400);
macAddress = BitConverter.ToString(array, 404, macLength);
macAddress = macAddress.Replace("-", ":");
return macAddress;
}
else
return "";
}