► Afficher le texte
Code : Tout sélectionner
#include <Constants.au3>
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
GUICreate("Péripherique USB", 300, 80, -1, -1,-1,0x00000080)
GUICtrlCreateLabel("Voulez-vous activer ou désactiver les peripherique de masse?", 5, 10, 300, 17)
$activer = GUICtrlCreateButton("Activer USB",60,50,90)
$desactiver = GUICtrlCreateButton("Désactiver USB",160,50,90)
GUICtrlSetOnEvent($activer,"active")
GUICtrlSetOnEvent($desactiver,"desactiv")
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState(@SW_SHOW)
While 1
sleep(100)
Wend
func desactiv()
$desactiver = Run(@ComSpec & " /c " & 'reg add HKLM\system\CURRENTCONTROLSET\SERVICES\USBSTOR /V start /t REG_DWORD /d 4 /f', "", @SW_HIDE) ; désactive
Exit
EndFunc
Func active()
$activer = Run(@ComSpec & " /c " & 'reg add HKLM\system\CURRENTCONTROLSET\SERVICES\USBSTOR /V start /t REG_DWORD /d 3 /f', "", @SW_HIDE) ; active
Exit
EndFunc
Func CLOSEClicked()
exit
EndFunc[/spoiler]
Romain