为什么在使用CWnd :: EnableWindow启用按钮后,CCmdUI :: Enable禁用按钮? [英] Why does CCmdUI::Enable disable a button after I enable it with CWnd::EnableWindow?

查看:79
本文介绍了为什么在使用CWnd :: EnableWindow启用按钮后,CCmdUI :: Enable禁用按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作要求我维护一些旧的MFC程序,并且要求我将CButton添加到现有对话框中.即使我的代码调用CWnd::EnableWindow来启用按钮,但CCmdUI::Enable 也会禁用它.

这是CWnd::Enable 禁用按钮时堆栈跟踪的一部分.

My job requires me to maintain some old MFC programs, and I''ve been asked to add a CButton to an existing dialog. Even though my code calls CWnd::EnableWindow to enable the button, CCmdUI::Enable disables it.

Here is part of the stack trace at the moment CWnd::Enable disables the button.

mfc90d.dll!CWnd::EnableWindow()
mfc90d.dll!CCmdUI::Enable()
mfc90d.dll!CCmdUI::DoUpdate()
mfc90d.dll!CWnd::UpdateDialogControls()
mfc90d.dll!CMFCReBar::OnUpdateCmdUI()
mfc90d.dll!CControlBar::OnIdleUpdateCmdUI()
mfc90d.dll!CWnd::OnWndMsg()
mfc90d.dll!CWnd::WindowProc()
mfc90d.dll!CControlBar::WindowProc()
mfc90d.dll!AfxCallWndProc()
mfc90d.dll!CWnd::SendMessageToDescendants()
mfc90d.dll!CWnd::SendMessageToDescendants()
mfc90d.dll!CWinThread::OnIdle()
mfc90d.dll!CWinApp::OnIdle()


同一对话框上的其他按钮不会发生这种情况,因此我感到困惑,为什么MFC应该单选此按钮来禁用它.

感谢您提供有关如何防止CCmdUI 禁用按钮的任何帮助.


This does not happen to other buttons on the same dialog, so I am perplexed why MFC should single out this button for disabling.

Any help on how to prevent CCmdUI from disabling the button is appreciated.

推荐答案

收费栏按钮将被禁用
虽然它的命令没有反应
从所有者框架的侧面...

...这不是任何对话框的堆栈:)
A tollbar button would be disabled
while there is no reaction for its command
from the side of the owner frame...

...that is not a stack of any dialog :)


这篇关于为什么在使用CWnd :: EnableWindow启用按钮后,CCmdUI :: Enable禁用按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆