leowlf
asked on
Enable Menu Item
I need to disable the Maximize button on the CMainFrame, but why does my code works only for the the Close button and NOT for the Maximize button?
CMenu *pMenu = AfxGetMainWnd()->GetSystem Menu(FALSE ) ;
// doesn't works!!
if (pMenu) pMenu->EnableMenuItem(SC_M AXIMIZE, MF_BYCOMMAND|MF_DISABLED ) ;
// works!!
if (pMenu) pMenu->EnableMenuItem(SC_C LOSE, MF_BYCOMMAND|MF_DISABLED ) ;
CMenu *pMenu = AfxGetMainWnd()->GetSystem
// doesn't works!!
if (pMenu) pMenu->EnableMenuItem(SC_M
// works!!
if (pMenu) pMenu->EnableMenuItem(SC_C
ASKER
Sorry VinExpert,
I need to enable and disable the 'maximize' button during runtime under certain conditions.
I need to enable and disable the 'maximize' button during runtime under certain conditions.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To disable the maximize button, open ur mainframe.cpp and go to PreCreateWindow() function and at the start add the following line of code
cs.style &= ~WS_MAXIMIZEBOX;
That should work. similarly for minimize button also.
Hope this helps.
VinExpert