2

Windows モバイル プロジェクトがあります。ソフトウェアのセキュリティのために、デバイスの MAC アドレスまたは番号を取得したいと考えています。私のプロジェクトは Windows Ce と Windows Mobile 6 (2 つのプロジェクト) です。モバイル デバイスから値を取得するにはどうすればよいですか? (同じ質問を見ましたが、Bluetooth MACアドレスに関するもので、一部のデバイスにはありません)

4

2 に答える 2

2

GetAdaptersInfoAPI を呼び出します。IP_ADAPTER_INFOデバイスのアダプタに関するすべての情報のバッファである を返します。には、アダプタの MAC アドレスであるというIP_ADAPTER_INFOメンバが含まれています。Address

于 2011-08-26T13:08:05.720 に答える
0

これに対する VB.NET の方法を見つけるのに多くの時間がかかるため、役立つ可能性のある人のためにこれを投稿します。

<DllImport("iphlpapi.dll", SetLastError:=True)> _
Public Shared Function GetAdaptersInfo(ByVal info As Byte(), ByRef size As UInteger) As Integer
        End Function

        Public Shared Function GetMacAddress() As String
            Dim num As UInteger = 0UI
            GetAdaptersInfo(Nothing, num)
            Dim array As Byte() = New Byte(CInt(num) - 1) {}
            Dim adaptersInfo As Integer = GetAdaptersInfo(array, num)
            If adaptersInfo = 0 Then
                Dim macAddress As String = ""
                Dim macLength As Integer = BitConverter.ToInt32(array, 400)
                macAddress = BitConverter.ToString(array, 404, macLength)
                macAddress = macAddress.Replace("-", ":")

                Return macAddress
            Else
                Return ""
            End If
于 2015-07-01T01:47:32.297 に答える