If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) ButtonGadget(1,10,10,100,20,"Entfernen",0) If CreateMenu(0,WindowID(0)) MenuTitle("Programm") MenuItem(1,"Beenden") EndIf Repeat EventID=WaitWindowEvent() If EventID=#PB_Event_Gadget Select EventGadget() Case 1 RemoveMenu_(MenuID(0),1,0) EndSelect EndIf Until EventID = #PB_Event_CloseWindow EndIf