Dein select Gedöns ist bei ganzen 2 Auswahlmöglichkeiten unsinn, zumal du für "Nein" garnichts tun musst, die msgbox verschwindet einfach wenn du "Nein" klickst und diesen Fall nicht abdeckst.
PS: Dein Script hatte doch so sogar funktioniert ![]()
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 116, 78, 673, 309)
$Button1 = GUICtrlCreateButton("Button1", 8, 8, 99, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 8, 40, 99, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer ; öhm ja brauchste eigtl nicht, aber meinetwegen
$iMsgBoxAnswer = MsgBox(292,"Test","Wirklich beenden?")
if $iMsgBoxAnswer = 6 then Exit
if $iMsgBoxAnswer = 7 then Sleep(10) ; brauchste auch garnicht diese Zeile, wollte dir nur die Möglichkeit lassen auch was sinnvolles zu tun...
EndSwitch
WEnd