Link to home
Start Free TrialLog in
Avatar of joakimf
joakimf

asked on

Disable Maximize and Size.

I made a Dialog based app, and I have the minimized button but the maximize is greyed out. If you right-click the system menu (the colored line on the top of the window) you still get the option to maximize and change size. I would like to disable them. Is that possible? I would like the code please since I'm new at MFC.
ASKER CERTIFIED SOLUTION
Avatar of nil_dib
nil_dib

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nil_dib
nil_dib

ouuchh
..and set the style member of the CREATESTRUCT....
should be
..and remove the WS_MAXIMIZEBOX/WS_MINIMIZEBOX flags from the style member of the CREATESTRUCT....
Avatar of joakimf

ASKER

Well, it's not the buttons. I want to be able to minimize the window with the button. I want to remove the maximize text in the right-click menu or atleast grey out.
If you have one button enabled (min or max) then the other button is visible, but grayed out -> text in sysmenu is visible and grayed out.
If you have no button then there is no text in the sysmenu.
>> I would like to disable them
both buttons?
Avatar of joakimf

ASKER

The text Maximize is NOT grayed out but the button is.
Avatar of joakimf

ASKER

The text Maximize is NOT grayed out but the button is.
Ok, I see
the other way is to get the pointer of the sysmenu and to manipulate the menu with the CMenu member functions:

BOOL CMinDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    .....
    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        // e.g. remove the first string in the sysmenu
        pSysMenu->ModifyMenu(0,MF_BYPOSITION,MF_STRING);
        ......
look also for CMenu::EnableMenuItem and CMenu::InsertMenu

hmm, if you are talking about disabling the text to the menu that appears on the dialog title, then just go to the dialog editor; goto properties of the dialog box and select "thin frame" for the dialog instead of "dialog frame."  Recompile your program and the maximize option in the menu should now be grayed out.
Avatar of joakimf

ASKER

Thank you