http://topic.csdn.net/u/20100627/13/43d4fd97-146b-4b85-a0fe-e4b70c60efb3.html
通过编程方法获得网卡的物理地址.
'自己写的
Option Explicit
Private Sub Command1_Click()
Call GetMacAddress
End Sub
Function GetMacAddress() As String
Dim i&, j&, OutChar$
Dim fn As Byte, pos1&, pos2&, ArrayChar$(1)
'输出IP信息
Shell "cmd /c ipconfig/all > C:\Ping", vbHide
fn = FreeFile
RETRY:
Open "c:\ping" For Binary Access Read As #fn
OutChar$ = Space$(FileLen("c:\ping"))
'读取IP信息
Get #fn, , OutChar$
Close #fn
If Len(OutChar$) = 0 Then GoTo RETRY
'搜索Physical Address
pos1 = InStr(OutChar$, "Physical Address")
Do While pos1 <> 0
'搜索:标志
pos2 = InStr(pos1, OutChar$, ":")
'取MAC Address, 长度18
ArrayChar(j) = Mid$(OutChar$, pos2 + 1, 18)
'判断是否有多个网卡
pos1 = InStr(pos2, OutChar$, "Physical Address")
If pos1 <> 0 Then j = j + 1
Loop
For i = 1 To j + 1
MsgBox "第" & i & "个网卡的MAC ADDRESS 是" & ArrayChar(i - 1)
Next
Kill "C:\Ping"
End Function
请问各位大侠的问题,既然这个程序能读网卡的物理地址.
能否在此基础,修改网卡的物理地址.