Click here to Skip to main content
15,847,903 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
The bad behaviour was caused by a not-yet fully understood modification in another CDockablePane that messed up the focus; it causes the button to loose the focus and I did not visually see that when I thought I clicked on the button, I was putting the focus back to it; and if I was lucky enough to click fast enough on the button before it loosed focus again.

We reverted the small changes that cause that more important problem.

Thanks again.


I've got a simple MFC application with menus, and a menu item and a CDockablePane containing a CButton.

The application creates a worker thread ( by doing a new CWinThread derived class)

Both menu item and the button will call the same code; the code will stop the thread.

When running the application, the thread is created and is doing its job, when the menu item is selected, the handler is called and the code stopping the thread works normally.

When I try clicking on the button (the button is enabled) nothing happen, the handler is not called, or I have to click like demented person and eventually the handler will be called.


The button is created in a window (CWnd) inside the CDockablePane.

The button is enabled/disabled by using ON_UPDATE_COMMAND_UI (as explained in Applying an update UI notification interface to user-defined controls[^]) with the WM_IDLEUPDATECMDUI message to call UpdateDialogControls(this, FALSE);.



I don't know if there is a way or if there is a message that will give that particular UI a "nudge" to handle the button message with a higher priority.


Updated 6-Jun-13 8:35am
Richard MacCutchan 6-Jun-13 12:39pm    
Try using your debugger to find out what happens when you click it.
Maximilien 6-Jun-13 13:12pm    
A non-issue, see the update I wrote at the top of the question. Thanks.

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