MAC Address in Compact Framework

How can I get the MAC address using only compact structure?

+3
source share
4 answers

1.4 OpenNETCF code retrieves information from the following P / Invoke call:

    [DllImport ("iphlpapi.dll", SetLastError=true)]
    public static extern int GetAdaptersInfo( byte[] ip, ref int size );

The physical address (returned as the MAC address), I think, around the index is 400-408 byte array after the call. That way you can just use it directly if you don't want to use OpenNETCF (why so? OpenNETCF is more scalable than stone manga!)

Wonderful P / Invoke.net gives a complete example here .

Oh, and correctly answer your question:

only using Compact Framework

. CF, , .: D

+5

System.Management.dll - :

Dim mc As System.Management.ManagementClass
Dim mo As ManagementObject
mc = New ManagementClass("Win32_NetworkAdapterConfiguration")
Dim moc As ManagementObjectCollection = mc.GetInstances()
For Each mo In moc
    If mo.Item("IPEnabled") = True Then
        ListBox1.Items.Add("MAC address " & mo.Item("MacAddress").ToString())
    End If
Next
0

, MAC- LOCAL_MACHINE\Comm\PCI\***\Parms\MacAddress.

, WMI OpenNETCF...

0

All Articles