How can I get ride of the 'X' that closes an application.
-
-
I would like my SDI/CFormView application to be either minimized or maximized but not zoomed. That much I have done. But how can I get rid of the 'X' on the menu bar that closes the application? cs.style = WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX ;
I am not sure you can get rid of it if you have a minimize box. What I do in an app is gray out the box and handle the OnQueryEndSession() message.
BOOL CCommonApp::DisableClose(BOOL bDisable) { BOOL retVal = (m_pMainWnd != NULL); if ( retVal ) { CMenu* pMenu = m_pMainWnd->GetSystemMenu(FALSE); if ( pMenu ) { CMainFrame* pMainFrame = DYNAMIC_DOWNCAST(CMainFrame,m_pMainWnd); pMenu->EnableMenuItem(SC_CLOSE,MF_BYCOMMAND | bDisable ? MF_GRAYED : MF_ENABLED); } } return retVal; }
John -
I would like my SDI/CFormView application to be either minimized or maximized but not zoomed. That much I have done. But how can I get rid of the 'X' on the menu bar that closes the application? cs.style = WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX ;