可以修改本地网卡的MAC地址并重启生效,查看WMI的属性字段。WIN7下测试通过,需要管理员权限运行。修改无线网卡时第二位必须是2,6,A,E要想改其他的得改驱动,具体可以百度下。
Private Sub btnStop_Click(sender As Object, e As System.EventArgs) Handles btnStop.Click If NetWorkState(Me.cmbNetWork.SelectedValue.ToString()) Then
If Not DisableNetWork(NetWork(Me.cmbNetWork.SelectedValue.ToString())) Then
MessageBox.Show("禁用网卡失败!")
Else
MessageBox.Show("禁用网卡成功!")
End If
Else
MessageBox.Show("网卡己禁用!")
End If NetWorkList()
End Sub
Private Sub ReConnect(NetWorkName As String)
If NetWorkState(NetWorkName) Then
If Not DisableNetWork(NetWork(NetWorkName)) Then
MessageBox.Show("禁用网卡失败!")
Else
MessageBox.Show("禁用网卡成功!")
End If
Else
MessageBox.Show("网卡己禁用!")
End If
If NetWorkState(NetWorkName) Then
If Not EnableNetWork(NetWork(NetWorkName)) Then
MessageBox.Show("开启网卡失败!")
Else
MessageBox.Show("开启网卡成功!")
End If
Else
MessageBox.Show("网卡己开启!")
End If
End Sub
Private Sub cmbNetWork_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles cmbNetWork.SelectedIndexChanged End Sub
Public Sub New() ' 此调用是设计器所必需的。
InitializeComponent() ' 在 InitializeComponent() 调用之后添加任何初始化。
NetWorkList()
End Sub Private Sub 设置MAC_Click(sender As System.Object, e As System.EventArgs) Handles 设置MAC.Click
Dim x As New DynamicMAC.MACHelper
x.SetMACAddress(StrConv(SetMacAddessV.Text.Replace("-", ""), VbStrConv.Uppercase), Me.cmbNetWork.SelectedValue.ToString())
ReConnect(Me.cmbNetWork.SelectedValue.ToString()) End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim x As New DynamicMAC.MACHelper
Dim y As List(Of String) y = x.GetAdapterPara(Me.cmbNetWork.SelectedValue.ToString())
ParaList.DataSource = y
MsgBox(x.GetAdapterIndex(Me.cmbNetWork.SelectedValue.ToString()))
MsgBox(x.IPAddress x.MacAddress x.NetWorkName) End Sub
评论