Hallo zusammen,
wie im Header bereits erwähnt, bekomme ich meine Routine nur über die HotKey Variante gestoppt, nicht über das Menü oder einen Button. Leider habe ich nicht die leiseste Ahnung, warum das so nicht möglich ist. Vielleicht findet jemand von Euch meinen Fehler, danke im Vorraus.
AutoIt
#include <GUIConstants.au3>
HotKeySet('{F10}','_startRoutine')
HotKeySet('{F11}','_stopRoutine')
Global Const $GUI = GUICreate('Test',300,150, -1, -1, $WS_SYSMENU,$WS_EX_TOPMOST)
Global $gm_Menu = GUICtrlCreateMenu("Steuerung")
Global $gm_Menu_run = GUICtrlCreateMenuItem("Programm starten",$gm_Menu)
Global $gm_Menu_stop = GUICtrlCreateMenuItem("Programm stoppen",$gm_Menu)
GUICtrlCreateMenuItem("", $gm_Menu, 3)
Global $gm_Menu_exit = GUICtrlCreateMenuItem("Beenden",$gm_Menu)
Global $gB_Button1 = GUICtrlCreateButton ("Stopp", 10, 50,60,30)
Global $gL_Label1 = GUICtrlCreateLabel("Zeit",10,10,100,20,1,5)
Global $stop = false
GUISetState(@SW_SHOW, $GUI)
While 1
Switch GUIGetMsg()
Case -3,$GUI_EVENT_CLOSE,$gm_Menu_exit
GUIDelete()
Exit
Case $gm_Menu_run
_startRoutine()
Case $gm_Menu_stop,$gB_Button1
_stopRoutine()
EndSwitch
WEnd
Func _startRoutine()
While $stop = false
For $i = 0 to 60
GUICtrlSetData($gL_Label1,$i)
Sleep(1000)
If $stop = True then ExitLoop
Next
WEnd
;
EndFunc
Func _stopRoutine()
$stop = true
;MsgBox(-1,"Abbruch","Ablauf gestoppt",2)
EndFunc
Alles anzeigen
Gruß