WM_INITMENUPOPUP
hmenuPopup = (HMENU) wParam; /* handle of pop-up menu */
nIndex = (int) LOWORD(lParam); /* index of pop-up menu */
fSystemMenu = (BOOL) HIWORD(lParam); /* System-menu flag */
The WM_INITMENUPOPUP message is sent when a pop-up menu is about to become active. This allows an application to modify the pop-up menu before it is displayed, without changing the entire menu.
hmenuPopup
Value of wParam. Identifies the pop-up menu.
nIndex
Value of the low-order word of lParam. Specifies the index of the pop-up menu in the main menu.
fSystemMenu
Value of the high-order word of lParam. Specifies a nonzero value if the pop-up menu is the System menu (sometimes referred to as the Control menu); otherwise, this parameter is zero.
An application should return zero if it processes this message.
This example initializes the items in a pop-up menu:
int nCount;
WORD wItem;
UINT uID;
case WM_INITMENUPOPUP:
nCount = GetMenuItemCount(wParam);
for (wItem = 0; wItem < nCount; wItem++) {
uID = GetMenuItemID(wParam, wItem);
.
. /* Initialize menu items. */
.
}
break;