Da mußt du zusätzlich zu ID/Event auch das Fensterhandle auswerten:
Spoiler anzeigen
#include <GUIConstants.au3>
$main = GUICreate("Hallo", 300, 200)
$bild_B = GUICtrlCreateButton("Bild öffnen", 98, 70, 100, 50)
GUISetBkColor(0xe0c782)
GUICtrlCreateLabel("made by codemaster", 107, 180)
GUISetState()
$child = GUICreate("", 700, 550)
$back_B = GUICtrlCreateButton("Zurück", 310, 515, 80, 25)
While 1
$msg = GUIGetMsg(1)
Switch $msg[1] ; Window-Handle
Case $main
Switch $msg[0] ; Control-ID, Event
Case $GUI_EVENT_CLOSE
Exit
Case $bild_B
GUISetState(@SW_SHOW, $child)
GUISetState(@SW_HIDE, $main)
EndSwitch
Case $child
Select
Case $msg[0] = $GUI_EVENT_CLOSE Or _
$msg[0] = $back_B
GUISetState(@SW_HIDE, $child)
GUISetState(@SW_SHOW, $main)
EndSelect
EndSwitch
WEnd