0

I have a CMenu instance. I would like to dynamically traverse all menu and sub-menu items in the menu.

The API for getting a sub-menu is called CMenu::GetSubMenu. Its lone parameter is the sub-menu's position (zero based index) within the parent menu.

How do I get the positions of all sub-menus?

4

1 回答 1

3

Call CMenu::GetMenuItemCount() to determine the number of menu items. Iterate over the menu items, calling CMenu::GetSubMenu(nPos) for each to determine whether that menu item has a submenu (i.e. the call does not return NULL).

于 2013-03-30T21:13:40.027 回答