Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Problem in Toolbar Control -Buttons are disbled after clicking first time Collapse All
Subject Author Date
Jagdish Vasani Nov 29, 2007 - 8:45 AM


I am using CExtToolControlBar instance to load toolbar , in that toolbar is shown perfect ,but when I click any button ,then that button goes to disabled state..And if i click button from chevrn`s popup window that is working fine.

I am using Toolbar control in ATL Composite control- DLL Project . I am createing and loading toolbar in OninitDialog() method of composite Control.

what will be wrong with my code.

Thanks in Advance !!

Technical Support Dec 2, 2007 - 1:36 PM

The CExtToolControlBar window uses the MFC’c command updating mechanism for controlling enabled/disabled and checked/unchecked states of all its buttons. This mechanism works automatically in MFC EXE projects where the main application’s message loop is fully performed by MFC frame window inside CWinApp class. When this message loop goes into the idle state, UI elements like toolbar buttons become updated automatically. So, you should simply add command handler and/or command updating methods for all toolbar buttons and menu items in your project.

MFC regular DLL projects such as ActiveX and other COM controls with or without ATL usage do not control the message loop and, as a result, the MFC’s command updating mechanism does not work here as it should. To make it working in MFC DLLs, you should run some timer in the main window of your control with 100 ms period and invoke ::AfxGetApp()->OnIdle(); from the timer handler method. This time will emulate the normal idle processing time of MFC EXE module and all the UI elements will become updated correctly.