Столкнулся с проблемой назначения принудительного завершения цикла на кнопку.
Вот код:
#include <GUIConstants.au3>
#Region ### S
$Form3 = GUICreate("Signalization", 278, 95, 434, 275)
GUISetBkColor(0xB9D1EA)
$Button1 = GUICtrlCreateButton("Stop", 8, 40, 113, 41, $BS_DEFPUSHBUTTON)
GUICtrlSetBkColor(-1, 0xFF0000)
$Button2 = GUICtrlCreateButton("Start", 144, 40, 113, 41, $BS_DEFPUSHBUTTON)
GUICtrlSetBkColor(-1, 0x00FF00)
GUISetState(@SW_SHOW)
#EndRegion ###
$Color = 0x00FF00
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button2
While 1
If PixelGetColor (1072 , 110) <> $Color Then
SoundPlay ('C:\Users\User\Desktop\02070.mp3' , 1)
EndIf
Wend
Case $Button1
ExitLoop
EndSwitch
Wend
Вот код:
#include <GUIConstants.au3>
#Region ### S
$Form3 = GUICreate("Signalization", 278, 95, 434, 275)
GUISetBkColor(0xB9D1EA)
$Button1 = GUICtrlCreateButton("Stop", 8, 40, 113, 41, $BS_DEFPUSHBUTTON)
GUICtrlSetBkColor(-1, 0xFF0000)
$Button2 = GUICtrlCreateButton("Start", 144, 40, 113, 41, $BS_DEFPUSHBUTTON)
GUICtrlSetBkColor(-1, 0x00FF00)
GUISetState(@SW_SHOW)
#EndRegion ###
$Color = 0x00FF00
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button2
While 1
If PixelGetColor (1072 , 110) <> $Color Then
SoundPlay ('C:\Users\User\Desktop\02070.mp3' , 1)
EndIf
Wend
Case $Button1
ExitLoop
EndSwitch
Wend