Hi itsmeandnobodyelse,
thanks for the reply - but, my problem ist not the update-mechanism, my problem is that menu-commands can be called via shortcut while the view has the capture.
My application is a CAD like application with a complex GUI within a CScrollView. There are about 15 or more dialogs which can be opened via shortcuts while no drag operation in the view is active. As soon as the user starts a drag-operation the capture is set to the view, it's released when the drag operation finished.
With 'old' MFC there was no problem since menu commands weren't executed with their shortcuts as long as capture was set. With 'new' MFC (or better said as soon as a CMFCMenuBar is involved) this doesn't work anymore.
Of course now I coul implement a ON_UPDATE_COMMAND_UI handler for each of these menue commands, but I'm searching for a more generic way to get this working as it did in 'old' MFC.
In MSDN about 'SetCapture' there's this statement:
> When the mouse is captured, menu hotkeys and other keyboard accelerators do not work.
This in fact is not the case anymore when using the CMFCMenuBar.
Regards,
ZOPPO
Main Topics
Browse All Topics





by: itsmeandnobodyelsePosted on 2008-10-27 at 07:46:14ID: 22813136
>>>> When the view has set the mouse capture (SetCapture) commands from menues with shortcut are executed allthough they shouldn't be available.
The menu updates (reflecting both on toolbar buttons and menu items) were made in idle times only. In case of mouse capture there might be many many mouse move messages which might prevent from ever entering the idle message handling.
You should capture the mouse only when it is above a control of interest and free it when ever it is outside of the controls. Especially, when clicking at a toolbar button and/or opening a menu, the mouse should not be captured (and so the menu items were up-to-date)