|
-
June 5th, 2012, 01:24 PM
#1
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
-
June 5th, 2012, 01:28 PM
#2
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);
}
-
June 5th, 2012, 01:40 PM
#3
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
-
June 5th, 2012, 01:59 PM
#4
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...
-
June 5th, 2012, 03:24 PM
#5
Re: Making system menu go away
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|