MENUITEMINFO

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This structure contains information about a menu item.

Syntax

typedef struct tagMENUITEMINFO {
  UINT cbSize; 
  UINT fMask; 
  UINT fType; 
  UINT fState; 
  UINT wID; 
  HMENU hSubMenu; 
  HBITMAP hbmpChecked; 
  HBITMAP hbmpUnchecked; 
  DWORD dwItemData; 
  LPTSTR dwTypeData; 
  UINT cch; 
} MENUITEMINFO, FAR* LPMENUITEMINFO; 

Members

  • cbSize
    Size of structure, in bytes. The caller must set this to sizeof(MENUITEMINFO).
  • fMask
    Members to retrieve or set. It can be one or more of these values.

    Value Description

    MIIM_CHECKMARKS

    Retrieves or sets the hbmpChecked and hbmpUnchecked members.

    MIIM_DATA

    Retrieves or sets the dwItemData member.

    MIIM_ID

    Retrieves or sets the wID member.

    MIIM_STATE

    Retrieves or sets the fState member.

    MIIM_SUBMENU

    Retrieves or sets the hSubMenu member.

    MIIM_TYPE

    Retrieves or sets the fType and dwTypeData members.

    MIIM_FULLSTR

    Modifies the MIIM_TYPE flag to retrieve a complete string, including prefix characters, when paired with menu items of type MFT_STRING.

  • fType
    Menu item type. It can be one or more of these values.

    Value Description

    MFT_MENUBARBREAK

    Places the menu item on a new line (for a menu bar) or in a new column (for a drop-down menu, submenu, or shortcut menu). For a drop-down menu, submenu, or shortcut menu, a vertical line separates the new column from the old.

    MFT_MENUBREAK

    Places the menu item on a new line (for a menu bar) or in a new column (for a drop-down menu, submenu, or shortcut menu). For a drop-down menu, submenu, or shortcut menu, the columns are not separated by a vertical line.

    MFT_OWNERDRAW

    Assigns responsibility for drawing the menu item to the window that owns the menu. The window receives a WM_MEASUREITEM message before the menu is displayed for the first time, and a WM_DRAWITEM message whenever the appearance of the menu item must be updated. If this value is specified, the dwTypeData member contains an application-defined 32-bit value.

    MFT_RADIOCHECK

    Displays checked menu items using a radio-button mark instead of a check mark if the hbmpChecked member is NULL.

    MFT_SEPARATOR

    Specifies that the menu item is a separator. A menu item separator appears as a horizontal dividing line. The dwTypeData and cch members are ignored. This value is valid only in a drop-down menu, submenu, or shortcut menu.

    MFT_STRING

    Displays the menu item using a text string. The dwTypeData member is the pointer to a null-terminated string, and the cch member is the length of the string.

    The MFT_SEPARATOR and MFT_STRING values cannot be combined with one another.

  • fState
    Menu item state. It can be one or more of these values.

    Value Description

    MFS_CHECKED

    Checks the menu item. For more information about checked menu items, see the hbmpChecked member.

    MFS_ENABLED

    Enables the menu item so that it can be selected. This is the default state.

    MFS_HILITE

    Highlights the menu item.

    MFS_UNCHECKED

    Unchecks the menu item. For more information about unchecked menu items, see the hbmpUnchecked member.

    MFS_UNHILITE

    Removes the highlight from the menu item. This is the default state.

  • wID
    Application-defined 16-bit value that identifies the menu item.
  • hSubMenu
    Handle to the drop-down menu or submenu associated with the menu item. If the menu item is not an item that opens a drop-down menu or submenu, this member is NULL.
  • hbmpChecked
    This item is ignored.
  • hbmpUnchecked
    This item is ignored.
  • dwItemData
    Specifies the application-defined value associated with the menu item.
  • dwTypeData
    Specifies the content of the menu item. This member is used only if the MIIM_TYPE flag is set in the fMask member.

    Before calling GetMenuItemInfo, the application must set this member to point to a buffer whose length is specified by the cch member. If the retrieved menu item is of the type MFT_STRING, then GetMenuItemInfo copies the menu item text to the buffer. If the MIIM_FULLSTR flag is set in conjunction with the MIIM_TYPE flag and the menu item is of the type MFT_STRING, then GetMenuItemInfo will retrieve the complete text, including prefix characters. If the retrieved menu item is of some other type, then GetMenuItemInfo sets the dwTypeData member to a value whose type is specified by the fType member. The MIIM_FULLSTR flag does not affect menu items which are not of type MFT_STRING.

    When using with the SetMenuItemInfo function, this member should contain a value whose type is specified by the fType member.

  • cch
    Length of the menu item text when information is received about a menu item of the MFT_STRING type. This member is used only if the MIIM_TYPE flag is set in the fMask member and is zero otherwise. This member is ignored when the content of a menu item is set by calling SetMenuItemInfo.

    Before calling GetMenuItemInfo, the application must set this member to the length of the buffer pointed to by the dwTypeData member. If the retrieved menu item is of type MFT_STRING (as indicated by the fType member), then GetMenuItemInfo sets cch to the length of the retrieved string. If the retrieved menu item is of some other type, GetMenuItemInfo sets the cch member to zero.

Remarks

The MENUITEMINFO structure is used with the GetMenuItemInfo and SetMenuItemInfo functions. See the documentation for these functions to determine which members of MENUITEMINFO are supported for each operation.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

GetMenuItemInfo
SetMenuItemInfo
WM_DRAWITEM
WM_MEASUREITEM
Menus Structures