Solved

.NET CF: Get MAC address of Pocket PC

Posted on 2004-10-30
4,720 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
Question by:drj5y
    4 Comments
     
    LVL 48

    Accepted Solution

    by:
    0
     
    LVL 7

    Assisted Solution

    by:CJCraft
    "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
    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
    And here is the direct link for downloading openNetCF:
    http://www.opennetcf.org/download.asp?product=SmartDeviceFramework12

    /Brutu_Z
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    IT Security CISA, CISSP & CISM Certification

    Master the advanced techniques required to protect network resources from external threats with the IT Cyber Security bundle. Built around industry best-practice guidelines, the IT Cyber Security bundle consists of three in-depth courses.

    Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
    Let me explain this picture a little bit.  First, in case you haven't already guessed, you are looking at my 2 phones, an Android Samsung Galaxy S5 on the left and an iPhone 5 on the right.  They are on their respective cradles on my desk.  But, you…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.

    875 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now