GetMenuState

  UINT GetMenuState(hmenu, uItem, fuFlags)    
  HMENU hmenu; /* handle of menu */
  UINT uItem; /* menu-item to query */
  UINT fuFlags; /* menu flags */

The GetMenuState function retrieves the menu flags associated with the specified menu item. If the menu item invokes a pop-up menu, this function also returns the number of items in the pop-up menu.

Parameters

hmenu

Identifies the menu that contains the menu item whose flags are to be retrieved.

uItem

Specifies the menu-item for which the menu flags are to be retrieved, as determined by the fuFlags parameter.

fuFlags

Specifies how the uItem parameter is interpreted. This parameter can be one of the following values:

Value Meaning

MF_BYCOMMAND The uItem parameter specifies the identifier of the menu item.
MF_BYPOSITION The uItem parameter specifies the zero-based relative position of the menu item.

Return Value

The return value is -1 if the specified item does not exist. If the uItem parameter identifies an item that invokes a pop-up menu, the low-order byte of the return value contains the menu flags associated with the item (see the following list), and the high-order byte contains the number of items in the pop-up menu invoked by the item. Otherwise, the return value is a mask (Boolean OR) of the values from the following list (this mask describes the status of the menu item that uItem identifies):

Value Meaning

MF_CHECKED Check mark is placed next to item (items in pop-up menus only).
MF_DISABLED Item is disabled.
MF_GRAYED Item is disabled and grayed.
MF_MENUBARBREAK Same as MF_MENUBREAK, except for pop-up menus, where the new column is separated from the old column by a vertical line.
MF_MENUBREAK Item is placed on a new line (menu bars) or in a new column (pop-up menus) without separating columns.
MF_SEPARATOR Horizontal dividing line (pop-up menus only).

See Also

GetMenu, GetMenuString, GetMenuItemCount, GetMenuItemID