Solved

Disable Maximize and Size.

Posted on 1999-01-12
9
557 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:joakimf
  • 4
  • 4
9 Comments
 
LVL 4

Accepted Solution

by:
nil_dib earned 50 total points
ID: 1327514
You can use the resource workshop to set the style of the dialog.
Open resource workshop
Open your dialog
View->Properties
Styles->check out the min/max checkbox
Or
Override the PreCreateWindow method (with the class wizzard) and set the style member of the CREATESTRUCT (cs) to WS_MAXIMIZEBOX/WS_MINIMIZEBOX :
cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX )

0
 
LVL 4

Expert Comment

by:nil_dib
ID: 1327515
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....
0
 
LVL 1

Author Comment

by:joakimf
ID: 1327516
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:nil_dib
ID: 1327517
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?
0
 
LVL 1

Author Comment

by:joakimf
ID: 1327518
The text Maximize is NOT grayed out but the button is.
0
 
LVL 1

Author Comment

by:joakimf
ID: 1327519
The text Maximize is NOT grayed out but the button is.
0
 
LVL 4

Expert Comment

by:nil_dib
ID: 1327520
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

0
 

Expert Comment

by:SileNcer
ID: 1327521
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.
0
 
LVL 1

Author Comment

by:joakimf
ID: 1327522
Thank you
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question