Hi.
How can I disable the systemmenu and all icons - except the minimize-button from titlebar in a window?
My program run in systray and the user should only minimize the window.
Frank
Titlebar and system-icons
Frank,
You can enable/disable the Minimize and Maximize buttons using the #PB_Window_MinimizeGadget and #PB_Window_MaximizeGadget constants in the OpenWindow() function. If you want to disable the Close button too, you can call this procedure, passing it the Window identifier.
Regards,
Eric
You can enable/disable the Minimize and Maximize buttons using the #PB_Window_MinimizeGadget and #PB_Window_MaximizeGadget constants in the OpenWindow() function. If you want to disable the Close button too, you can call this procedure, passing it the Window identifier.
Code: Select all
Procedure DisableCloseButton(Window.l)
; get handle to window's system menu
hMenu.l = GetSystemMenu_(WindowID(Window), 0)
If hMenu
; get number of items in the menu
menuItemCount.l = GetMenuItemCount_(hMenu)
; remove system menu Close menu item
; menu item is 0-based, so the last
; item on the menu is menuItemCount - 1
RemoveMenu_(hMenu, menuItemCount - 1, #MF_REMOVE|#MF_BYPOSITION)
; remove system menu separator line
RemoveMenu_(hMenu, menuItemCount - 2, #MF_REMOVE|#MF_BYPOSITION)
; force a redraw of the menu, to
; refresh the titlebar, dimming the X
DrawMenuBar_(WindowID(Window))
EndIf
EndProcedure
Eric