MainFrame without Close 
Author Message
 MainFrame without Close

Does anyone know how to create a MainFrame window without a close box? I
have a SDI application that I would like to close via a dialog box that is
always resident, not the close box of the MainFrame. I would like to keep
the menu and tool bar attached though.

Thanks,
Ron



Sat, 17 Jan 2004 09:01:24 GMT  
 MainFrame without Close
Hi,

To disable the Close Button on your SDI system menu, you need to add the
following code in one of your frame function:

CMenu *pSysMenu = GetSystemMenu(FALSE);
ASSERT(pSysMenu != NULL);
VERIFY(pSysMenu->RemoveMenu(SC_CLOSE, MF_BYCOMMAND));                
SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0L);

Thanks,
Freist



Sat, 17 Jan 2004 19:46:45 GMT  
 MainFrame without Close
Thanks Freist, that disabled the close button. Do you know of a way to
remove the icon as well?

Thanks,
Ron.


Quote:
> Hi,

> To disable the Close Button on your SDI system menu, you need to add the
> following code in one of your frame function:

> CMenu *pSysMenu = GetSystemMenu(FALSE);
> ASSERT(pSysMenu != NULL);
> VERIFY(pSysMenu->RemoveMenu(SC_CLOSE, MF_BYCOMMAND));
> SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0L);

> Thanks,
> Freist



Sun, 18 Jan 2004 00:25:37 GMT  
 MainFrame without Close
Hi,

By design, the Windows allows you to remove the Maximize & Miminize buttons
from the caption bar. The Windows also allows you to remove "all the
buttons"
on the caption bar by removing the WS_SYSMENU style from the
CREATESTRUCT.style. But it does not let you remove just the Close button.  
Disable the Close button is a proper method.

Thanks,
Freist



Sat, 24 Jan 2004 23:03:11 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Close all views without closing the Doc

2. closing the main frame window without closing the application

3. application error when close the MainFrame window

4. Dialog Open while MainFrame closed?

5. Mainframe Close & WM_QUIT

6. Cannot forward command messages to mainframe from controlbar after last user-created view is closed

7. MDI MainFrame without title bar

8. How to wait for a child form to close without using ShowDialog()

9. Closing App without 'Save Dlg'?

10. How do I create an MDI child window without a close button (X in upper

11. Wheres the Code Guru's - Closing CFileDialog without pressing the OPEN Button

12. Close Modal Dialog without destroying the window and controls

 

 
Powered by phpBB® Forum Software