首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

VB6:怎么得到本机IP,计算机名和MAC

2012-03-08 
VB6:如何得到本机IP,计算机名和MACVB6:如何得到本机IP,计算机名和MAC[解决办法]我现在用的。需要WinsockVB

VB6:如何得到本机IP,计算机名和MAC
VB6:如何得到本机IP,计算机名和MAC

[解决办法]
我现在用的。需要Winsock

VB code
'*************************************************************'取本机MAC地址Private Function GetRemoteMACAddress(ByVal sRemoteIP As String, sRemoteMacAddress As String) As Boolean    Dim dwRemoteIP   As Long    Dim pMacAddr   As Long    Dim bpMacAddr()   As Byte    Dim PhyAddrLen   As Long    Dim cnt   As Long    Dim tmp   As String    dwRemoteIP = inet_addr(sRemoteIP)    If dwRemoteIP <> 0 Then         PhyAddrLen = 6         If SendARP(dwRemoteIP, 0&, pMacAddr, PhyAddrLen) = NO_ERROR Then             If pMacAddr <> 0 And PhyAddrLen <> 0 Then                  ReDim bpMacAddr(0 To PhyAddrLen - 1)                  CopyMemory bpMacAddr(0), pMacAddr, ByVal PhyAddrLen                  For cnt = 0 To PhyAddrLen - 1                      If bpMacAddr(cnt) = 0 Then                        tmp = tmp & "00-"                      Else                       tmp = tmp & Hex$(bpMacAddr(cnt)) & "-"                      End If                  Next                 If Len(tmp) > 0 Then                       sRemoteMacAddress = Left$(tmp, Len(tmp) - 1)                       GetRemoteMACAddress = True                  End If                  Exit Function                Else                    GetRemoteMACAddress = False                End If          Else           GetRemoteMACAddress = False          End If       Else         GetRemoteMACAddress = False    End IfEnd Function 

热点排行