我想得到本机网卡MAC地址,我已经能够获指定IP的MAC地址,但怎样才能获得本机IP?

解决方案 »

  1.   

    Sub GetMyIP()
        Dim strComputer As String
        Dim objWMI      As Object
        Dim colIP       As Object
        Dim IP          As Object
        Dim I           As Integer    strComputer = "."
        Set objWMI = GetObject("winmgmts://" & strComputer & "/root/cimv2")
        Set colIP = objWMI.ExecQuery _
            ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
        For Each IP In colIP
            If Not IsNull(IP.IPAddress) Then
               For I = LBound(IP.IPAddress) To UBound(IP.IPAddress)
                   MsgBox "IP  地址:" & IP.IPAddress(I) & Chr(10) & _
                          "網卡類型:" & IP.Description(I) & Chr(10) & _
                          "網卡地址:" & IP.Macaddress(I)
               Next
            End If
        Next
      

  2.   

    楼上的,在asp里又怎样取网卡IP地址呢?请到这里来看。
    http://community.csdn.net/Expert/topic/5202/5202308.xml?temp=.6461603