Solved

Disable Maximize and Size.

Posted on 1999-01-12
9
553 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now