?
Solved

Disabling a menu item on a dialog menu

Posted on 2008-06-20
2
Medium Priority
?
1,155 Views
Last Modified: 2013-12-14
I have an VC 6.0 app.  In design time, I created a menu on the main dialog.  The resource ID is IDR_MAINFRAME.  Like many windows programs, this menu has three menus.  From left to right, the menus are "File", "View", and "Help".  On my "View" menu, I want to be able to enable/disable the fourth menu item, during runtime, depending on the user's input.

I've tried processing the ON_UPDATE_COMMAND_UI message for the menu item, but my message handler function is never getting called.  If I use the resource ID of the first menu item in the "View" menu,  in connection with ON_UPDATE_COMMAND_UI.  In this case, my message handler function DOES get called.  But then how do I reference the fourth menu item?

Thanks ahead of time.
0
Comment
Question by:clintonJ
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 21835191
it should work, no matters if it is the first or fourth.
maybe you missed something, is the function correctly declared and implemented? like:

void CYourMainDlg::OnUpdateYourFunction(CCmdUI* pCmdUI)
{
}

also, how do you determine it is called? are you sure of that?
0
 

Author Closing Comment

by:clintonJ
ID: 31469332
Sometimes I get tripped up by the obivous.  :0  The message handler for the ON_UPDATE_COMMAND_UI message was already implemented when I inherited this code.  I didn't realize this.  Thus, the original author's message handler function was getting called, which of course was preventing mine from getting called.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

809 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