?
Solved

Enable Menu Item

Posted on 2000-04-21
3
Medium Priority
?
1,039 Views
Last Modified: 2013-11-20
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()->GetSystemMenu(FALSE) ;

// doesn't works!!
if (pMenu)  pMenu->EnableMenuItem(SC_MAXIMIZE, MF_BYCOMMAND|MF_DISABLED ) ;

// works!!
if (pMenu)  pMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND|MF_DISABLED ) ;
0
Comment
Question by:leowlf
[X]
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
3 Comments
 
LVL 8

Expert Comment

by:VinExpert
ID: 2737565
Hi,

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
0
 

Author Comment

by:leowlf
ID: 2737984
Sorry VinExpert,

I need to enable and disable the 'maximize' button during runtime under certain conditions.
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 200 total points
ID: 2738686
This appears to work, why the other doesn't work I do know:

CString str;

pMenu->GetMenuString(SC_MAXIMIZE, str, MF_BYCOMMAND);
pMenu->ModifyMenu(SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED, 0, str);

Good Luck,
Steve
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

762 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