Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Local $TITRE = "GuiUpdateTest"
$Form1 = GUICreate($TITRE, 635, 323, 192, 124)
$Group1 = GUICtrlCreateGroup("Indicators Update", 16, 8, 601, 121)
$Input1 = GUICtrlCreateInput("DFXSPEED", 110, 32, 113, 21)
$Input2 = GUICtrlCreateInput("", 110, 64, 113, 21)
$Input3 = GUICtrlCreateInput("", 110, 96, 113, 21)
$Button1 = GUICtrlCreateButton("Send Command", 500, 32, 100, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Send Command", 500, 64, 100, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Send Command", 500, 96, 100, 25, $WS_GROUP)
GUICtrlCreateLabel("Indicator Name :", 24, 32, 82, 17)
GUICtrlCreateLabel("Indicator Name :", 24, 64, 82, 17)
GUICtrlCreateLabel("Indicator Name :", 24, 96, 82, 17)
GUICtrlCreateLabel("Indicator Value :", 232, 32, 82, 17)
GUICtrlCreateLabel("Indicator Value :", 232, 64, 82, 17)
GUICtrlCreateLabel("Indicator Value :", 232, 96, 82, 17)
$Input7 = GUICtrlCreateInput("-", 318, 32, 113, 21)
$Input8 = GUICtrlCreateInput("-", 318, 64, 113, 21)
$Input9 = GUICtrlCreateInput("-", 318, 96, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Sliders Update", 16, 136, 601, 121)
$Input4 = GUICtrlCreateInput("GPXSLIDER1", 110, 160, 113, 21)
$Input5 = GUICtrlCreateInput("", 110, 192, 113, 21)
$Input6 = GUICtrlCreateInput("", 110, 224, 113, 21)
$Button4 = GUICtrlCreateButton("Send Command", 500, 160, 100, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("Send Command", 500, 192, 100, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("Send Command", 500, 224, 100, 25, $WS_GROUP)
GUICtrlCreateLabel("Slider Name :", 24, 160, 82, 17)
GUICtrlCreateLabel("Slider Name :", 24, 192, 82, 17)
GUICtrlCreateLabel("Slider Name :", 24, 224, 82, 17)
GUICtrlCreateLabel("Slider Value :", 232, 160, 82, 17)
GUICtrlCreateLabel("Slider Value :", 232, 192, 82, 17)
GUICtrlCreateLabel("Slider Value :", 232, 224, 82, 17)
$Input10 = GUICtrlCreateInput("-", 318, 160, 113, 21)
$Input11 = GUICtrlCreateInput("-", 318, 192, 113, 21)
$Input12 = GUICtrlCreateInput("-", 318, 224, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button7 = GUICtrlCreateButton("Exit", 500, 272, 100, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
If GUICtrlRead($Input1) = "" Then GUICtrlSetState($Button1,$GUI_DISABLE)
If GUICtrlRead($Input2) = "" Then GUICtrlSetState($Button2,$GUI_DISABLE)
If GUICtrlRead($Input3) = "" Then GUICtrlSetState($Button3,$GUI_DISABLE)
If GUICtrlRead($Input4) = "" Then GUICtrlSetState($Button4,$GUI_DISABLE)
If GUICtrlRead($Input5) = "" Then GUICtrlSetState($Button5,$GUI_DISABLE)
If GUICtrlRead($Input6) = "" Then GUICtrlSetState($Button6,$GUI_DISABLE)
#cs
Local $stop = False
While Not $stop
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE,$Button7
$stop = True
Case $Button1
Local $texte_Button7 = GUICtrlRead($Button7)
GUICtrlSetData($Button7,"Cancel")
For $i= 0 to 65535 Step Round(65535/20,0)
GUICtrlSetData($Input7,$i)
Local $timer = TimerInit()
Do
$msg = GUIGetMsg()
$stop = ($msg = $GUI_EVENT_CLOSE Or $msg = $Button7)
Until TimerDiff($timer)>2000 Or $stop
If $stop Then
If $msg = $Button7 Then
TrayTip($TITRE, "décompte arrêté à " & GuiCtrlRead($Input7),30,2)
$stop = False
EndIf
ExitLoop
EndIf
Next
GUICtrlSetData($Button7,$texte_Button7)
EndSwitch
WEnd
#ce
;#cs
Local $stop = False
While Not $stop
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE,$Button7
$stop = True
Case $Button1
Local $texte_Button1 = GUICtrlRead($Button1)
GUICtrlSetData($Button1,"Stop Command")
For $i= 0 to 65535 Step Round(65535/20,0)
GUICtrlSetData($Input7,$i)
Local $timer = TimerInit()
Do
$msg = GUIGetMsg()
$stop = ($msg = $GUI_EVENT_CLOSE Or $msg = $Button7)
Until TimerDiff($timer)>2000 Or $stop
If $stop Then
If $msg = $Button1 Then
TrayTip($TITRE, "décompte arrêté à " & GuiCtrlRead($Input7),30,2)
$stop = False
EndIf
ExitLoop
EndIf
Next
GUICtrlSetData($Button1,$texte_Button1)
Case $Button2
Local $texte_Button2 = GUICtrlRead($Button2)
GUICtrlSetData($Button2,"Stop Command")
For $i= 0 to 65535 Step Round(65535/20,0)
GUICtrlSetData($Input8,$i)
Local $timer = TimerInit()
Do
$msg = GUIGetMsg()
$stop = ($msg = $GUI_EVENT_CLOSE Or $msg = $Button7)
Until TimerDiff($timer)>2000 Or $stop
If $stop Then
If $msg = $Button2 Then
TrayTip($TITRE, "décompte arrêté à " & GuiCtrlRead($Input8),30,2)
$stop = False
EndIf
ExitLoop
EndIf
Next
GUICtrlSetData($Button2,$texte_Button2)
Case $Input1
If GUICtrlRead($Input1) <> "" Then GUICtrlSetState($Button1,$GUI_ENABLE)
Case $Input2
If GUICtrlRead($Input2) <> "" Then GUICtrlSetState($Button2,$GUI_ENABLE)
Case $Input3
If GUICtrlRead($Input3) <> "" Then GUICtrlSetState($Button3,$GUI_ENABLE)
Case $Input4
If GUICtrlRead($Input4) <> "" Then GUICtrlSetState($Button4,$GUI_ENABLE)
Case $Input5
If GUICtrlRead($Input5) <> "" Then GUICtrlSetState($Button5,$GUI_ENABLE)
Case $Input6
If GUICtrlRead($Input6) <> "" Then GUICtrlSetState($Button6,$GUI_ENABLE)
EndSwitch
WEnd