Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Disable Maximize and Size.

Posted on 1999-01-12
9
556 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 105
matchUp  challenge 6 69
twoTwo  challenge 35 107
abstract class with all non abstract mentods 6 80
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

828 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