Making system menu go away
I have an SDI Doc/View application with CFormView as the base class. I want the close box (System Menu) to not be available to the user. The System Menu property for the main form has no effect on this for some reason. Is there something in the Doc/View classes that overrides the property box, or maybe I'm looking at the wrong thing?
Thanks
Re: Making system menu go away
Override your CMainFrame's PreCreateWindow and remove the style
Code:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~WS_SYSMENU;
return CFrameWnd::PreCreateWindow(cs);
}
Re: Making system menu go away
But of course, even without the system menu, the user can still use accelerators like alt-F4 to close the program.
If you want the program to be "uncloseable" you need to do more work than simply removing the system menu.
Mike
Re: Making system menu go away
I hope you have a very good reason for disabling it. Every time I encounter an application that disable this and that for some obscure reason it makes me furious.
I like to work like I'm used to and expect every application to behave like a normal Windows application (or being un-installed and replaced with something else). I don't want the minimize button to be disabled, I don't want the window to be on top of everything, I don't want the window to force itself into fullscreen and so on...
Re: Making system menu go away
Quote:
Originally Posted by
GCDEF
Override your CMainFrame's PreCreateWindow and remove the style
Code:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~WS_SYSMENU;
return CFrameWnd::PreCreateWindow(cs);
}
Thank you, that worked.