Last Modification: April 15, 2000

How can I update my menu in a dialog? I tried adding a ON_COMMAND_UPDATE handler but it never gets called!

That's because CDialog is derived directly from CWnd, while the code that calls the ON_COMMAND_UPDATE handlers is in CFrameWnd-derived classes only. What you need to do is handle the updates in the old-fashioned way, as in SDK apps, by writing a handler for the WM_INITMENU message. On this handler, you can then use CMenu's methods to manipulate the menu.

To be able to add the necessary message handler to your dialog class using ClassWizard, you'll need to change the message filter from "Dialog" to "Window". To do this, open ClassWizard and change to the "Class Info" tab. Then, select your class and change the filter on the combobox at the bottom of the property page labeled "Message Filter".