vb获取MAC和CPU 唯一序列号

发布网友 发布时间:2024-10-23 22:07

我来回答

1个回答

热心网友 时间:2024-10-30 20:32

Private Sub Form_Load() Dim Mac strComputer = "." Mac = "" '获得MAC信息 Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2")'''加上这个 Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") For Each objItem In colItems Mac = Mac + " " + objItem.macaddress Next TeMac.Text = Replace(Trim(Mac), ":", "-") 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) 'Mac = Ip.macaddress(I)objObject.DNSHostName If Ip.ipaddress(i) = "0.0.0.0" Then Else TeIp.Text = Trim(TeIp.Text + " " + Ip.ipaddress(i)) End If 'MsgBox "IP 地址:" & IP.ipaddress(I) & Chr(10) & _ "网卡类型:" & IP.Description(I) & Chr(10) & _ "网卡地址:" & IP.macaddress(I) Next End If Next End Sub

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com