.NET CF: Get MAC address of Pocket PC

I need a simple C# function that returns a string representing the MAC address of the Pocket PC's WiFi network adapter. Thanks in advance for your help.
LVL 1
drj5yAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CJCraftCommented:
"You will have to P/Invoke the GetAdaptersInfo() API call in iphlpapi.dll.

Check out Mr Feinman's sample:
http://www.alexfeinman.com/download.asp?doc=AdapterInfo.zip"
0
brutu_zCommented:
OpenCF is a free-to-use library for .NET look here:
http://www.opennetcf.org/library/OpenNETCF.Net.html
You need to create a openCF.net.adapter and call the adapter.MacAddress.
http://www.opennetcf.org/library/OpenNETCF.Net.AdapterMembers.html

I used this myself to get the associeted accesspoint, the MAC address and the current signalstrength of the wifi-card connection on a PocketPC.

a code example (in VB.NET CF but it is almost the same in C#):
-
Imports System
Imports OpenNETCF
Imports OpenNETCF.Net
-

'Declare the Networking instance
Dim Networkinstance As OpenNETCF.Net.Networking
'Declare a instance of an networkadapter
Dim MyAdapter As OpenNETCF.Net.Adapter
'Declare the collection of installed networkadapters
Dim MyAdapters As OpenNETCF.Net.AdapterCollection

'load adapter collection with adapter items
MyAdapters = Networkinstance.GetAdapters

'Declare a bitconverter class to convert the MAC addres in
'a human readable form
Dim bc As BitConverter
dim x as int32
'iterate through the dedected adapters
For x = 0 To (MyAdapters.Count - 1)

MyAdapter = MyAdapters.Item(x)
'display some information about the adapters found
msgBox("name: " & MyAdapter.Name.ToString)

msgBox("MAC Address: " & bc.ToString(MyAdapter.MacAddress)

msgBox("IP: "  & MyAdapter.CurrentIpAddress.ToString)

If MyAdapter.IsWireless Then msgBox("accessPoint:" & MyAdapter.AssociatedAccessPoint.ToString)
If MyAdapter.IsWireless Then msgBox("Type:" & MyAdapter.SignalStrength.ToString)

Next x

----

Good Luck !

0
brutu_zCommented:
And here is the direct link for downloading openNetCF:
http://www.opennetcf.org/download.asp?product=SmartDeviceFramework12

/Brutu_Z
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.