Partager via


CMenu::TrackPopupMenuEx

Displays a floating pop-up menu at the specified location and tracks the selection of items on the pop-up menu.

BOOL TrackPopupMenuEx( 
   UINT fuFlags, 
   int x, 
   int y, 
   CWnd* pWnd, 
   LPTPMPARAMS lptpm 
);

Parameters

  • fuFlags
    Specifies various functions for the extended menu. For a listing of all values and their meaning, see TrackPopupMenuEx.

  • x
    Specifies the horizontal position in screen coordinates of the pop-up menu.

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

  • pWnd
    A pointer to the window owning the pop-up menu and receiving the messages from the created menu. This window can be any window from the current application but cannot be NULL. If you specify TPM_NONOTIFY in the fuFlags parameter, the function does not send any messages to pWnd. The function must return for the window pointed to by pWnd to receive the WM_COMMAND message.

  • lptpm
    Pointer to a TPMPARAMS structure that specifies an area of the screen the menu should not overlap. This parameter can be NULL.

Return Value

If you specify TPM_RETURNCMD in the fuFlags parameter, the return value is the menu-item identifier of the item that the user selected. If the user cancels the menu without making a selection, or if an error occurs, then the return value is 0.

If you do not specify TPM_RETURNCMD in the fuFlags parameter, the return value is nonzero if the function succeeds and 0 if it fails. To get extended error information, call GetLastError.

Remarks

A floating pop-up menu can appear anywhere on the screen. For more information on handling errors when creating the pop-up menu, see TrackPopupMenuEx.

Requirements

Header: afxwin.h

See Also

Reference

CMenu Class

Hierarchy Chart

CMenu::CreatePopupMenu

CMenu::GetSubMenu