Solved

Disabling a menu item on a dialog menu

Posted on 2008-06-20
2
1,128 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
notReplace  challenge 53 116
NOTEPAD++ Meaning of (+) and (-) Icons 6 101
countEvens challenge 2 74
Third Party On Screen Keyboard, numeric only. 9 53
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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
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.

911 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