Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Creat0R

Must AutoIt


Сообщения: 3054
Благодарности: 1009

Профиль | Сайт | Отправить PM | Цитировать


ВО! такой вариант работает по нажатию на горячую клавишу (Ctrl S), почему же событие не срабатывает при нажатии на кнопку?


Код: Выделить весь код
Opt("GuiOnEventMode", 1)
#include <GUIConstants.au3>
HotKeySet("^s", "SetExitLoop")

Global $ExitLoop, $Mark = 10
$gui = GUICreate("Abort GUI", 420, 140, -1, -1, $WS_SIZEBOX)
$Button = GUICtrlCreateButton("Start", 180, 20, 70)
GUICtrlSetOnEvent($Button, "Button")
GUISetOnEvent(-3, "ExitScript")

$Progress = GUICtrlCreateProgress(60, 60, 300, 15)
GUISetState(@SW_SHOW)

While 1
   Sleep(100)
WEnd

Func Button()
    GUICtrlSetData($Button, "Abort")
    While $ExitLoop = 0
        For $i = $Mark To 100
            If $i = 100 Then $i = 0
            GUICtrlSetData($Progress, $i)
            If $ExitLoop = 1 Then
                $Mark = $i
                ExitLoop
            EndIf
            Sleep(10)
        Next
    WEnd
    GUICtrlSetData($Button, "Start")
    $ExitLoop = 0
EndFunc

Func SetExitLoop()
    $ExitLoop = 1
EndFunc

Func ExitScript()
    Exit
EndFunc

-------
“Сделай так просто, как возможно, но не проще этого.”... “Ты никогда не решишь проблему, если будешь думать так же, как те, кто её создал.”

Альберт Эйнштейн

P.S «Не оказываю техподдержку через ПМ/ICQ, и по email - для этого есть форум. ©»

http://creator-lab.ucoz.ru/Images/Icons/autoit_icon.png Русское сообщество AutoIt | http://creator-lab.ucoz.ru/Images/Ic...eator_icon.png CreatoR's Lab | http://creator-lab.ucoz.ru/Images/Icons/oac_icon.png Opera AC Community


Отправлено: 01:59, 06-01-2007 | #104