• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4944
  • Last Modified:

.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.
  • 2
3 Solutions
"You will have to P/Invoke the GetAdaptersInfo() API call in iphlpapi.dll.

Check out Mr Feinman's sample:
OpenCF is a free-to-use library for .NET look here:
You need to create a openCF.net.adapter and call the adapter.MacAddress.

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 !

And here is the direct link for downloading openNetCF:

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.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now