?
Solved

How to remove menu by ID?

Posted on 1998-04-24
7
Medium Priority
?
307 Views
Last Modified: 2013-11-19
I want to remove a menu IDR_MENU1 from the IDR_MAINFRAME.
Why my pmenu->RemoveMenu(IDR_MENU1, MF_BYCOMMAND) doesn't
work ?

IDR_MENU1 is a menu added to the IDR_MAINFRAME
via LoadMenu() command dynamically?

BOOL CMainFrame::MenuUnLoad(UINT MenuId)
{
      CMenu* pmenu = GetMenu();
//      pmenu->RemoveMenu(1, MF_BYPOSITION);  // This works
      pmenu->RemoveMenu(IDR_MENU1, MF_BYCOMMAND); // This doesn't
      DrawMenuBar();
      return TRUE;
}
0
Comment
Question by:nancytan
[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
  • 5
  • 2
7 Comments
 

Author Comment

by:nancytan
ID: 1302112
Edited text of question
0
 

Author Comment

by:nancytan
ID: 1302113
Edited text of question
0
 

Author Comment

by:nancytan
ID: 1302114
Edited text of question
0
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 

Author Comment

by:nancytan
ID: 1302115
Edited text of question
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 80 total points
ID: 1302116
You main menu is a menu.  It has submenus.  These cannot be removed by command, because they don't have commands - they are just submenus.  You can only remove a menu item by command (eg ID_FILE_NEW)

0
 

Author Comment

by:nancytan
ID: 1302117
So, there is no way to remove submenu other then by using
 pmenu->RemoveMenu(1, MF_BYPOSITION)?
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1302118
That is so (to the best of my knowledge)

Of course, you should be able to loop thru your menu and find a submenu that contains an item with a known id, then remove that submenu.

Or you can rely on knowing the order (eg help menu always last, file menu always first etc).

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

770 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