Compartir a través de


CContextMenuManager::TrackPopupMenu

Displays the specified shortcut menu and returns the index of the selected shortcut menu command.

virtual UINT TrackPopupMenu(
   HMENU hmenuPopup,
   int x,
   int y,
   CWnd* pWndOwner,
   BOOL bRightAlign = FALSE
);

Parameters

  • [in] hmenuPopup
    The handle of the shortcut menu that this method displays.

  • [in] x
    The horizontal offset for the shortcut menu in client coordinates.

  • [in] y
    The vertical offset for the shortcut menu in client coordinates.

  • [in] pWndOwner
    A pointer to the parent window of the shortcut menu.

  • [in] bRightAlign
    A Boolean parameter that indicates how menu items are aligned. If bRightAlign is TRUE, the menu is right-aligned for right-to-left reading order. If bRightAlign is FALSE, the menu is left-aligned for left-to-right reading order.

Return Value

The menu command ID of the command that the user chooses; 0 if the user closes the shortcut menu without selecting a menu command.

Remarks

This method functions as a modal call to display a shortcut menu. The application will not continue to the following line in code until the user either closes the shortcut menu or selects a command. An alternative method that you can use to display a shortcut menu is CContextMenuManager::ShowPopupMenu. That method is not a modal call and will not return the ID of the selected command.

Requirements

Header: afxcontextmenumanager.h

See Also

Reference

CContextMenuManager Class

Hierarchy Chart

CContextMenuManager::ShowPopupMenu