I am in a situation where I am programming in windows API and I display a
floating popup menu (via TrackPopupMenu) . I would like to force the menu
to popdown when the cursor moves off of the popup menu window. I have been
unsucessful in finding the popup menu window to obtain the rectangle’s size
and location to compare against the cursor’s location (using HMENU or
parent’s HWND) .
A solution which fell short was using the WM_NCHITTEST message to determine
that the cursor was over another tool and then popping the menu down; The
solution worked fine under Windows 98 and Windows 2000; however that
solution did not work under Windows NT (because windows NT does not send
WM_NCHITTEST messages while a popup menu is up).Another possible solution which fell short, was to track the WM_MENUSELECTs
and watch when they select and deselect menuitems; the solution works fine
for regular menus, but when used with a popup menu, there was never any
indication when themenuitem was unselected when moving the cursor outside
the popup menu.