如何在Windows Mobile 6.0设备的c#中以编程方式获取MAC地址

Vic*_*cky 7 .net c# mac-address windows-mobile

如何在Windows Mobile 6.0设备的c#中以编程方式获取MAC地址?net compatc framework 3.5不支持System.Net.NetworkInformation.

小智 0

我们可以使用 MDSDK 来解决此类问题,例如

\n\n
using PsionTeklogix.Peripherals;\nnamespace EnumAdapters\n{\n    public partial class Form1 : Form\n    {\n        public Form1()\n        {\n            InitializeComponent();\n\n            ArrayList pList = null;\n            string[] lStatistic = null;\n\n            try\n            {\n                pList = Peripherals.EnumerateAdapters();\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show("failed with\\r\\n" + ex.Message, "EnumerateAdapters()");\n                Close();\n                return;\n            }\n\n            listBox1.Items.Clear();\n\n            foreach (string AdapterName in pList)\n            {\n                try\n                {\n                    listBox1.Items.Add(AdapterName + (Peripherals.IsAdapterPresent(AdapterName) ? " is present" : " is NOT present") + (Peripherals.IsWirelessAdapter(AdapterName) ? " [wireless adapter] " : ""));\n                    lStatistic = Peripherals.GetAdapterStatistics(AdapterName); // See Note 1\n                    foreach (string StatInfo in lStatistic)\n                    {\n                        if (StatInfo.StartsWith("Local MAC Address"))\n                        {\n                            listBox1.Items.Add("\xc2\xbb " + StatInfo);\n                            break;\n                         }\n                    }\n                }\n                catch (Exception ex)\n                {\n                    MessageBox.Show(ex.Message);\n                    Close();\n                    return;\n                }\n            }\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n