Help Center

GetItemInfofunction

Retrieves information about a menu item.

Windowsfunctiondoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

FUNCTION GetItemInfo (BYVAL hMenu AS HMENU, BYVAL item AS UINT, BYVAL fByPosition AS BOOLEAN, BYVAL pmii AS MENUITEMINFOW PTR) AS BOOLEAN
FUNCTION GetItemInfo (BYVAL hMenu AS HMENU, BYVAL item AS UINT, BYVAL fByPosition AS BOOLEAN, BYREF mii AS MENUITEMINFOW) AS BOOLEAN

Parameters

NameDescription
hMenuA handle to the menu that contains the menu item.
itemThe identifier or position of the menu item to get information about. The meaning of this parameter depends on the value of fByPosition.
fByPositonThe meaning of item. If this parameter is FALSE, item is a menu item identifier. Otherwise, it is a menu item position
pmiiA pointer to a MENUITEMINFO structure that specifies the information to retrieve and receives information about the menu item. Note that you must set the cbSize member to sizeof(MENUITEMINFO) before calling this function.
miiA MENUITEMINFO structure that specifies the information to retrieve and receives information about the menu item. Note that you must set the cbSize member to sizeof(MENUITEMINFO) before calling this function.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, use the GetLastError function.

Description

Retrieves information about a menu item.

Remarks

To retrieve a menu item of type MFT_STRING, first find the size of the string by setting the dwTypeData member of MENUITEMINFO to NULL and then calling CMenu.GetItemInfo. The value of cch+1 is the size needed. Then allocate a buffer of this size, place the pointer to the buffer in dwTypeData, increment cch by one, and then call CMenu.GetItemInfo once again to fill the buffer with the string.

If the retrieved menu item is of some other type, then CMenu.GetItemInfo sets the dwTypeData member to a value whose type is specified by the fTypefType member and sets cch to 0.

Reference

  • Documented in Windows/WIndows Controls/CMenu Class.md
  • Topic: About Menus