增加禁用风速自动停止复选框
This commit is contained in:
@@ -74,18 +74,20 @@ Public Class NetworkHelp
|
||||
|
||||
|
||||
End Function
|
||||
Public Shared Sub SetNetworkAdapterDHCP()
|
||||
Public Shared Sub SetNetworkAdapterDHCP(Optional isetDHCP As Boolean = True)
|
||||
Dim mc As ManagementClass = New ManagementClass("Win32_NetworkAdapterConfiguration")
|
||||
Dim moc As ManagementObjectCollection = mc.GetInstances()
|
||||
If isetDHCP Then
|
||||
For Each mo As ManagementObject In moc
|
||||
If Not CBool(mo("IPEnabled")) Then Continue For
|
||||
mo.InvokeMethod("SetDNSServerSearchOrder", Nothing)
|
||||
mo.InvokeMethod("EnableStatic", Nothing)
|
||||
mo.InvokeMethod("SetGateways", Nothing)
|
||||
mo.InvokeMethod("EnableDHCP", Nothing)
|
||||
Exit For
|
||||
Next
|
||||
End If
|
||||
|
||||
For Each mo As ManagementObject In moc
|
||||
If Not CBool(mo("IPEnabled")) Then Continue For
|
||||
mo.InvokeMethod("SetDNSServerSearchOrder", Nothing)
|
||||
mo.InvokeMethod("EnableStatic", Nothing)
|
||||
mo.InvokeMethod("SetGateways", Nothing)
|
||||
mo.InvokeMethod("EnableDHCP", Nothing)
|
||||
Exit For
|
||||
Next
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user