Click here to Skip to main content
15,917,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
C++
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()

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.
Posted
Updated 5-Aug-10 7:42am
v2

1 solution

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 :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900