Print Page | Close Window

TrackPopupMenu on secondary UI thread

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=11551
Printed Date: 03 July 2024 at 3:09am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TrackPopupMenu on secondary UI thread
Posted By: qliklars
Subject: TrackPopupMenu on secondary UI thread
Date Posted: 23 July 2008 at 10:02am
We use MFC Commandbars (v11.2) in our application and in addition to building an "ordinary" application (EXE-file) we also build an ActiveX control (OCX-file).
 
In order to meet several requirements on the OCX, the UI is run on a different thread from the main thread in the application hosting the OCX.
 
We have noticed that TrackPopupMenu behaves strangely in this scenario.
If you bring it up, but click outside the menu (and outside the OCX) but inside the host application, the menu will not close.
 
I noticed that a MouseManager is used and that the MouseManager installs a mouse hook. The mouse hook is installed on the thread that runs the OCX UI, which means that it will not detect mouse messages sent to the main application and the menu will not be closed.
 
Is there a controlled way to solve this problem?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net