skiffle 0 Posted August 25, 2011 Hallo. After a GUIDelete and relaunch of the same GUI I have to click as many times as the GUI was restarted on the red close button to close the programm even when there is just one instanz open.. Why this happens? Please see my little script and thanks for any idea. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> new() Func new() $Form1 = GUICreate("IT-starts", 334, 200, 544, 120) GUISetIcon("") $btn = GUICtrlCreateButton("Ok", 40, 30, 60, 20) GUISetState(@SW_SHOW) While 1 $msg2 = GUIGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE ExitLoop Case $msg2 = $btn GUIDelete($Form1) new() EndSelect WEnd EndFunc Share this post Link to post Share on other sites
shornw 3 Posted August 25, 2011 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> new() Func new() $Form1 = GUICreate("IT-starts", 334, 200, 544, 120) GUISetIcon("") $btn = GUICtrlCreateButton("Ok", 40, 30, 60, 20) GUISetState(@SW_SHOW) While 1 $msg2 = GUIGetMsg() If $msg2 = $GUI_EVENT_CLOSE Then Exit Select ;Case $msg2 = $GUI_EVENT_CLOSE ;ExitLoop Case $msg2 = $btn GUIDelete($Form1) new() EndSelect WEnd EndFuncIs this what you want to achieve? [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font] Share this post Link to post Share on other sites