Hallo elitematthias,
und hier das Beispiel von @ideas2code im On Event Mode:
Spoiler anzeigen
[autoit]
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GuiOnEventMode", 1) ;On Event Modus bentzen
[/autoit] [autoit][/autoit] [autoit]$Form1 = GUICreate("Form1", 197, 117, 254, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Ende")
$Button1 = GUICtrlCreateButton("Button1", 64, 40, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_TuWas")
GUISetState(@SW_SHOW)
While 1
Sleep(1000)
WEnd
Func _Ende()
Exit
EndFunc ;==>_Ende
Func _TuWas()
MsgBox(0, "", "Ich mach was")
EndFunc ;==>_TuWas
mfg (Auto)Bert