`
Par2: Disabling red "X" 2006-10-22 -- Dennis Evans > Does anyone have any idea how to trap and disable the X button on the
> upper right hand side of the Window. I need to ensure that my user exit
> only through the exit button on the menu
>
equates
SC_CLOSE equate(0f060h)
MF_GRAYED equate(1)
prototypes
module('win32')
EnableMenuItem(signed hMenu, signed uIDEnableItem, signed
uEnable),bool,pascal,proc
DrawMenuBar(signed hWnd),bool,pascal
GetSystemMenu(signed hWnd, bool act),signed,pascal
end
code, after the window is opened where hMenu is a local long or signed
variable
hMenu = GetSystemMenu(self.myWindow{prop:handle}, false)
EnableMenuItem(hMenu, sc_close, MF_GRAYED)
DrawMenuBar(self.myWindow{prop:handle})
that will disable the close option and the X in the system menu, does not
handle alt-f4 and
the EscKey
Printed October 24, 2026, 3:05 pm This article has been viewed/printed 36268 times. |