怎么WinCE中得到智能设备的MAC地址?
我用设备是Symbol的3090,我想用C#程序实现读出它的MAC地址,是WINCE的,各位大哥有办法吗?救命那 --------------------编程问答-------------------- public string GetMacAddress(){
ManagementClass mc;
ManagementObjectCollection moc;
try
{
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
moc = mc.GetInstances();
}
catch
{
return "无法得到网卡物理地址!";
}
//****先得到网卡数目
int i = 0;
foreach(ManagementObject mo in moc)
{
if((bool)mo["IPEnabled"] == true)
{
i++;
}
mo.Dispose();
}
//***赋值给数组
ManagementClass mc_2 = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc_2 = mc_2.GetInstances();
string []array = new string[i];
int j = 0;
foreach(ManagementObject mo in moc_2)
{
if((bool)mo["IPEnabled"] == true)
{
string temp = mo["MacAddress"].ToString();
temp = temp.Replace(":","-");
array[j] = temp;
j++;
}
mo.Dispose();
}
string retv="";
foreach(string s in array)
retv+=s;
if(retv.Length>17)
{
retv=retv.Substring(0,17);
}
return retv;
}
wince 一样写,我以前搞过CASIO的采集器。 --------------------编程问答-------------------- CE里面没有Management这个引用吧? --------------------编程问答-------------------- 帮自己顶下,求助各位英雄啊 --------------------编程问答-------------------- 顶! --------------------编程问答-------------------- 关注ing
补充:.NET技术 , C#