

Code : Tout sélectionner
hSysMenu = GetSystemMenu_(WindowID(0), #False)
nb = GetMenuItemCount_(hSysMenu)
;Tu peux utiliser #MF_DISABLED OU #MF_REMOVE
RemoveMenu_(hSysMenu, nb - 1, #MF_REMOVE | #MF_BYPOSITION)
RemoveMenu_(hSysMenu, nb - 2, #MF_REMOVE | #MF_BYPOSITION)
Code : Tout sélectionner
hSysMenu = GetSystemMenu_(WindowID(0), #False)
RemoveMenu_(hSysMenu, #SC_CLOSE,#MF_BYCOMMAND)
Code : Tout sélectionner
hSysMenu = GetSystemMenu_(WindowID(), #False)
Nb = GetMenuItemCount_(hSysMenu)
EnableMenuItem_(hSysMenu, Nb - 1, #MF_DISABLED | #MF_BYPOSITION)
DrawMenuBar_(WindowID())
Code : Tout sélectionner
EnableMenuItem_(hSysMenu, Nb - 1, #MF_ENABLED | #MF_BYPOSITION)
DrawMenuBar_(WindowID())
Code : Tout sélectionner
Procedure SetMenuQuitState(OnOff.l)
hSysMenu = GetSystemMenu_(WindowID(), #False)
Nb = GetMenuItemCount_(hSysMenu)
EnableMenuItem_(hSysMenu, Nb - 1, OnOff | #MF_BYPOSITION)
DrawMenuBar_(WindowID())
EndProcedure
OnOff = 0
If OpenWindow(0, 200, 200, 200, 100, #PB_Window_SystemMenu, "Menu Example") And CreateGadgetList(WindowID(0))
If CreateMenu(0, WindowID())
MenuTitle("Project")
MenuItem(1, "Open" +Chr(9)+"Ctrl+O")
MenuItem(2, "Save" +Chr(9)+"Ctrl+S")
MenuItem(3, "Save as"+Chr(9)+"Ctrl+A")
MenuItem(4, "Close" +Chr(9)+"Ctrl+C")
ButtonGadget(5, 10, 10, 180, 20, "Standard Button")
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
Quit = 1
ElseIf EventID = #PB_EventGadget
If EventGadgetID() = 5
If OnOff
SetMenuQuitState(#false)
OnOff = #false
Else
SetMenuQuitState(#True)
OnOff = #true
EndIf
EndIf
EndIf
Until Quit
EndIf