The SetMenuItemInfo function changes information about a menu item.
Syntax
BOOL SetMenuItemInfo(
HMENU hMenu,
UINT uItem,
BOOL fByPosition,
LPMENUITEMINFO lpmii
);
Parameters
- hMenu
-
[in] Handle to the menu that contains the menu item.
- uItem
-
[in] Identifier or position of the menu item to change. The meaning of this parameter depends on the value of fByPosition.
- fByPosition
-
[in] Value specifying the meaning of uItem. If this parameter is FALSE, uItem is a menu item identifier. Otherwise, it is a menu item position. See Menu Programming Considerations for more information.
- lpmii
-
[in] Pointer to a MENUITEMINFO structure that contains information about the menu item and specifies which menu item attributes to change.
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.
Remarks
The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is in a displayed window.
In order for keyboard accelerators to work with bitmap or owner-drawn menu items, the owner of the menu must process the WM_MENUCHAR message. See Owner-Drawn Menus and the WM_MENUCHAR Message for more information.
Windows 95/98/Me: SetMenuItemInfoW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
Example
For an example, see Example of Owner-Drawn Menu Items.
Function Information
| Minimum DLL Version | user32.dll |
|---|
| Header | Declared in Winuser.h, include Windows.h |
|---|
| Import library | User32.lib |
|---|
| Minimum operating systems |
Windows 95, Windows NT 4.0 |
|---|
| Unicode | Implemented as
ANSI and Unicode versions. |
|---|
See Also