The GetMenuState function retrieves the menu flags associated with the specified menu item. If the menu item opens a submenu, this function also returns the number of items in the submenu.
The GetMenuState function has been superseded by the GetMenuItemInfo function. You can still use GetMenuState, however, if you do not need any of the extended features of GetMenuItemInfo.
UINT GetMenuState(
HMENU hMenu, |
// handle of menu |
UINT uId, |
// menu item to query |
UINT uFlags |
// menu flags |
); |
Value |
Description |
MF_BYCOMMAND |
Indicates that the uId parameter gives the identifier of the menu item. The MF_BYCOMMAND flag is the default if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified. |
MF_BYPOSITION |
Indicates that the uId parameter gives the zero-based relative position of the menu item. |
If the specified item does not exist, the return value is 0xFFFFFFFF.
If the menu item opens a submenu, the low-order byte of the return value contains the menu flags associated with the item, and the high-order byte contains the number of items in the submenu opened by the item.
Value |
Description |
MF_CHECKED |
Places a check mark next to the item (for drop-down menus, submenus, and shortcut menus only). |
MF_DISABLED |
Disables the item. |
MF_GRAYED |
Disables and grays the item. |
MF_HILITE |
Highlights the item. |
MF_MENUBARBREAK |
Functions the same as the MF_MENUBREAK flag, except for drop-down menus, submenus, and shortcut menus, where the new column is separated from the old column by a vertical line. |
MF_MENUBREAK |
Places the item on a new line (for menu bars) or in a new column (for drop-down menus, submenus, and shortcut menus) without separating columns. |
MF_SEPARATOR |
Creates a horizontal dividing line (for drop-down menus, submenus, and shortcut menus only). |