Mancoffee
Свет проталкивает тьму ...
- Сообщения
- 86
- Репутация
- 1
Данный скрипт при запуске сразу загружает процессор на 100%. Почему?
Код:
#NoTrayIcon
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ FileInstall('C:\devcon.exe', 'devcon.exe', 1)
;~ FileInstall('C:\lan_discon.ico', 'lan_discon.ico', 1)
;~ FileInstall('C:\lan_con.ico', 'lan_con.ico', 1)
;~ FileInstall('C:\wi-fi_discon.ico', 'wi-fi_discon.ico', 1)
;~ FileInstall('C:\wi-fi_con.ico', 'wi-fi_con.ico', 1)
;~ FileSetAttrib('devcon.exe', '+HT', 1)
;~ FileSetAttrib('lan_discon.ico', '+HT', 1)
;~ FileSetAttrib('lan_con.ico', '+HT', 1)
;~ FileSetAttrib('wi-fi_discon.ico', '+HT', 1)
;~ FileSetAttrib('wi-fi_con.ico', '+HT', 1)
FileInstall('C:\devcon.exe', @TempDir & '\devcon.exe', 1)
FileInstall('C:\lan_discon.ico', @TempDir & '\lan_discon.ico', 1)
FileInstall('C:\lan_con.ico', @TempDir & '\lan_con.ico', 1)
FileInstall('C:\wi-fi_discon.ico', @TempDir & '\wi-fi_discon.ico', 1)
FileInstall('C:\wi-fi_con.ico', @TempDir & '\wi-fi_con.ico', 1)
FileSetAttrib(@TempDir & '\devcon.exe', '+HT')
FileSetAttrib(@TempDir & '\lan_discon.ico', '+HT')
FileSetAttrib(@TempDir & '\lan_con.ico', '+HT')
FileSetAttrib(@TempDir & '\wi-fi_discon.ico', '+HT')
FileSetAttrib(@TempDir & '\wi-fi_con.ico', '+HT')
;#RequireAdmin
Opt("GUIOnEventMode", 1) ; Подключаем режим OnEvent
$ctrlcon = GUICreate("Connections", 217, 226, -1, 470)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
$DisLan = GUICtrlCreateButton("Disable Lan", 0, 0, 105, 105, $BS_DEFPUSHBUTTON + $BS_ICON)
GUICtrlSetImage(-1, @TempDir & "\lan_discon.ico")
GUICtrlSetOnEvent($DisLan, "DisLan")
$EnLan = GUICtrlCreateButton("Enable Lan", 112, 0, 105, 105, $BS_ICON)
GUICtrlSetImage(-1, @TempDir & "\lan_con.ico")
GUICtrlSetOnEvent($EnLan, "EnLan")
$DisWF = GUICtrlCreateButton("Disable Wi-Fi", 0, 120, 105, 105, $BS_ICON)
GUICtrlSetImage(-1, @TempDir & "\wi-fi_discon.ico")
GUICtrlSetOnEvent($DisWF, "DisWF")
$EnWF = GUICtrlCreateButton("Enable Wi-Fi", 112, 120, 105, 105, $BS_ICON)
GUICtrlSetImage(-1, @TempDir & "\wi-fi_con.ico")
GUICtrlSetOnEvent($EnWF, "EnWF")
GUISetState(@SW_SHOW)
WinSetOnTop('Connections', '', 1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func DisLan()
RunWait(@TempDir & '\devcon.exe disable @PCI\VEN_1969&DEV_1062*', '', @SW_HIDE)
EndFunc
Func EnLan()
RunWait(@TempDir & '\devcon.exe enable @PCI\VEN_1969&DEV_1062*', '', @SW_HIDE)
EndFunc
Func DisWF()
RunWait(@TempDir & '\devcon.exe disable @PCI\VEN_168C&DEV_002B*', '', @SW_HIDE)
EndFunc
Func EnWF()
RunWait(@TempDir & '\devcon.exe enable @PCI\VEN_168C&DEV_002B*', '', @SW_HIDE)
EndFunc
Func Close()
FileDelete(@TempDir & '\devcon.exe')
FileDelete(@TempDir & '\wi-fi_discon.ico')
FileDelete(@TempDir & '\wi-fi_con.ico')
FileDelete(@TempDir & '\lan_discon.ico')
FileDelete(@TempDir & '\lan_con.ico')
Exit
EndFunc