General discussion

Locked

Windows API Question

By alan.wendt ·
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.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Windows API Question

by leo.valmores In reply to Windows API Question

I am not a pro WINDOWs programmer, however; did some WINDOWs apps programming in C during the WIN3.1 era.

Just an idea: Before you execute the function that will evaluate WM_NCHITTEST or WM_MENUSELECT, would not it be possible in your routine/codes to insert a short sub-routine to find out what is the OS? I am pretty sure there must be a WIN API to determine PC's OS.

Hope this helps

Collapse -

Windows API Question

by alan.wendt In reply to Windows API Question

Poster rated this answer

Back to Windows Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums