Home > Archive > Visual Studio > January 2006 > Finding MAC of wireless card
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Finding MAC of wireless card
|
|
| Greg Baker 2006-01-10, 7:17 pm |
| Hi guys. I'm trying to get a char* representation of my wireless card's
MAC. I have tried using getAdaptersAddresses, but it doesn't return info
for the wireless card. That function returns info on my LAN card, and a
bunch of 'hidden' stuff (TCP Scheduler, etc.) but no wireless!
Does anyone know a good way to do this stuff in VC++ 6 or .NET or anything?
Thanks...
Greg
| |
| msnews.microsoft.com 2006-01-10, 7:17 pm |
|
Try using GetAdaptersInfo(), part of iphlpapi.lib.
Scott
"Greg Baker" <gbaker@cs.mun.ca> wrote in message
news:uHxX80gFGHA.644@TK2MSFTNGP09.phx.gbl...
> Hi guys. I'm trying to get a char* representation of my wireless card's
> MAC. I have tried using getAdaptersAddresses, but it doesn't return info
> for the wireless card. That function returns info on my LAN card, and a
> bunch of 'hidden' stuff (TCP Scheduler, etc.) but no wireless!
>
> Does anyone know a good way to do this stuff in VC++ 6 or .NET or
> anything?
>
> Thanks...
> Greg
| |
| Joe Mamma 2006-01-18, 7:04 pm |
| static string GetMacAddress(string ip)
{
ManagementClass mc = new
ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach(ManagementObject mo in moc)
{
if (System.Convert.ToBoolean(mo["IPEnabled"]))
{
if (ip.Equals(((string[])mo["IPAddress"])[0]))
return mo["MacAddress"].ToString();
}
}
return null;
}
.....
la.MachineIP =
System.Net.Dns.GetHostByName(la.MachineName).AddressList[0].ToString();
la.MachineMAC = GetMacAddress(la.MachineIP);
.......
"Greg Baker" <gbaker@cs.mun.ca> wrote in message
news:uHxX80gFGHA.644@TK2MSFTNGP09.phx.gbl...
> Hi guys. I'm trying to get a char* representation of my wireless card's
> MAC. I have tried using getAdaptersAddresses, but it doesn't return info
> for the wireless card. That function returns info on my LAN card, and a
> bunch of 'hidden' stuff (TCP Scheduler, etc.) but no wireless!
>
> Does anyone know a good way to do this stuff in VC++ 6 or .NET or
> anything?
>
> Thanks...
> Greg
|
|
|
|
|