vb取得本地计算机名称,VB6:怎么得到本机IP,计算机名和MAC

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 If

End Function

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值