int GetMenuItemCount(hmenu) | ||||
HMENU hmenu; | /* handle of menu, */ |
The GetMenuItemCount function determines the number of items in a pop-up or top-level menu.
hmenu
Identifies the handle of the menu to be examined.
The return value specifies the number of items in the menu if the function is successful. Otherwise, it is –1.
The following example initializes the items in a pop-up menu:
WORD wCount;
WORD wItem;
WORD wID;
case WM_INITMENUPOPUP:
wCount = GetMenuItemCount((HMENU) wParam);
for (wItem = 0; wItem < wCount; wItem++) {
wID = GetMenuItemID((HMENU) wParam, wItem);
.
. /* Initialize menu items. */
.
}
break;