对话框中的菜单命令更新处理程序
我有一个基于对话框的 MFC 应用程序。我的对话框有一个菜单,我正在使用描述的技术 此处在对话框中启用菜单加速器。
这工作正常,但我似乎找不到任何方法来实现菜单命令更新处理程序。或者,更确切地说,我已经实现了更新处理程序,但似乎找不到让 MFC 调用它们的好方法。
在网上搜索,我发现像 UpdateDialogControls()
这样的函数可以实现对话框子控件的命令更新处理程序。但我想对对话框菜单中的命令执行此操作。
有什么建议吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 MFC 不太感兴趣,我使用普通的 win32,但这看起来像您需要的
ON_UPDATE_COMMAND_UI
宏。如果您查看左侧导航菜单,您还可以找到“何时调用更新处理程序”主题。并确保在将句柄传递到窗口的任何地方,实际上都是将句柄传递到带有菜单的对话框(例如教程中的列表 3)。
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).