HotKeySet("{F3}", "Terminate")
NetWork()
Sleep(300000)
NetWork()
Func Terminate()
NetWork()
exit
EndFunc
Func NetWork()
Local $colItems
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM WIN32_NetworkAdapter", "WQL", 48)
If IsObj($colItems) Then
For $objItem In $colItems
If $objItem.NetConnectionID = "本地连接" Then
If $objItem.NetConnectionStatus <> 0 Then
$objItem.Disable
Else
$objItem.Enable
EndIf
EndIf
Next
Else
MsgBox(0, "", "err")
EndIf
EndFunc
按热键F3恢复,如果不按,5分钟后自动恢复 |