Menu Command Update Handlers in Dialog Boxes

随声附和 提交于 2020-02-05 04:42:07

问题


I have a dialog-based MFC application. My dialog box has a menu and I'm using the technique described here to enable menu accelerators in the dialog box.

This works fine but I can't seem to find any way to implement menu command update handlers. Or, rather, I've implemented update handlers but can't seem to find a good way to get MFC to call them.

Searching the web, I've found functions like UpdateDialogControls() to implement command update handlers for dialog child controls. But I want to do this for commands in a dialog box menu.

Any suggestions?


回答1:


I'm not much into MFC, I worked with plain win32 but this looks like what you need The ON_UPDATE_COMMAND_UI Macro. And if you look on the left navigation menu you can find also "When Update Handlers Are Called" topic.

And make sure everywhere you're passing handle to window you're actually passing handle to dialog box with menu (e.g. listing 3 in tutorial).



来源:https://stackoverflow.com/questions/7375534/menu-command-update-handlers-in-dialog-boxes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!