Solved

Disabling a menu item on a dialog menu

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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…
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.

705 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

19 Experts available now in Live!

Get 1:1 Help Now