Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

.NET CF: Get MAC address of Pocket PC

Posted on 2004-10-30
6
Medium Priority
?
4,891 Views
Last Modified: 2013-11-18
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.
0
Comment
Question by:drj5y
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
Mikal613 earned 96 total points
ID: 12454690
0
 
LVL 7

Assisted Solution

by:CJCraft
CJCraft earned 92 total points
ID: 12561266
"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
 

Assisted Solution

by:brutu_z
brutu_z earned 92 total points
ID: 12603597
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
 

Expert Comment

by:brutu_z
ID: 12603680
And here is the direct link for downloading openNetCF:
http://www.opennetcf.org/download.asp?product=SmartDeviceFramework12

/Brutu_Z
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When I was a beginner in Windows Mobile programming, even for small test I used to create a single MFC dialog-based application with one button, and put my test code in the OnLButtonDown method. For Pocket PC it worked fine, on some Windows CE dā€¦
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video ā€” there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, ā€¦
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question