Click here to Skip to main content
13,097,012 members (81,239 online)
Rate this:
Please Sign up or sign in to vote.
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.


Posted 6-Jun-13 5:43am
Updated 6-Jun-13 7: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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 6 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100