CMenu::TrackPopupMenu

BOOL TrackPopupMenu( UINT nFlags, int x, int y, CWnd* pWnd, LPCRECT lpRect = NULL );

Return Value

Nonzero if the function is successful; otherwise 0.

Parameters

nFlags

Specifies a screen-position flag and a mouse-button flag. The screen-position flag can be one of the following:

x

Specifies the horizontal position in screen coordinates of the pop-up menu. Depending on the value of the nFlags parameter, the menu can be left-aligned, right-aligned, or centered relative to this position.

y

Specifies the vertical position in screen coordinates of the top of the menu on the screen.

pWnd

Identifies the window that owns the pop-up menu. This window receives all WM_COMMAND messages from the menu. In Windows versions 3.1 and later, the window does not receive WM_COMMAND messages until TrackPopupMenu returns. In Windows 3.0, the window receives WM_COMMAND messages before TrackPopupMenu returns.

lpRect

Points to a RECT structure or CRect object that contains the screen coordinates of a rectangle within which the user can click without dismissing the pop-up menu. If this parameter is NULL, the pop-up menu is dismissed if the user clicks outside the pop-up menu. This must be NULL for Windows 3.0.

For Windows 3.1 and later, you can use the following constants:

Remarks

Displays a floating pop-up menu at the specified location and tracks the selection of items on the pop-up menu. A floating pop-up menu can appear anywhere on the screen.

CMenu OverviewClass MembersHierarchy Chart

See Also   CMenu::CreatePopupMenu, CMenu::GetSubMenu, ::TrackPopupMenu