EnableExplicit Define EventID If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) If OpenWindow(1, 0, 0, 300, 200, "ChildWindow", #PB_Window_SystemMenu | #PB_Window_ScreenCentered, WindowID(0)) EndIf Debug "Hauptfenster: " + WindowID(0) Debug "Unterfenster: " + WindowID(1) Debug "Letztes geöffnetes Fenster: " + GetLastActivePopup_(WindowID(0)) Repeat EventID = WaitWindowEvent() If EventID = #PB_Event_CloseWindow End EndIf ForEver EndIf