[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to remove menu by ID?

Posted on 1998-04-24
7
Medium Priority
?
316 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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month19 days, 21 hours left to enroll

873 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