Share via


CMenu::CreatePopupMenu

BOOLCreatePopupMenu();

Return Value

Nonzero if the pop-up menu was successfully created; otherwise 0.

Remarks

Creates a pop-up menu and attaches it to the CMenu object.

The menu is initially empty. Menu items can be added by using the AppendMenu or InsertMenu member function. The application can add the pop-up menu to an existing menu or pop-up menu. The TrackPopupMenu member function may be used to display this menu as a floating pop-up menu and to track selections on the pop-up menu.

If the menu is assigned to a window, it is automatically destroyed when the window is destroyed. If the menu is added to an existing menu, it is automatically destroyed when that menu is destroyed.

Before exiting, an application must free system resources associated with a pop-up menu if the menu is not assigned to a window. An application frees a menu by calling the DestroyMenu member function.

Example

See the example for CMenu::CreateMenu.

CMenu OverviewClass MembersHierarchy Chart

See Also   CMenu::CreateMenu, CMenu::InsertMenu, CWnd::SetMenu, CMenu::TrackPopupMenu, , CMenu::AppendMenu