Jump to content

MM SETITEMATTR

From EDM2
Revision as of 23:33, 14 April 2025 by Martini (talk | contribs) (Created page with "This message sets the attributes of a menu item. ==Syntax== <pre> param1 USHORT usitem; Item identifier.: USHORT usincludesubmenus; Include submenus indicator.: param2 USHORT usattributemask; Attribute mask.: USHORT usattributedata; Attribute data.: </pre> ==Parameters== ;''usitem'' (USHORT) - input: Item identifier. ;''usincludesubmenus'' (USHORT) - input: Include submenus indicator. :TRUE: If the menu does not have an i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This message sets the attributes of a menu item.

Syntax

param1
    USHORT usitem;            /* Item identifier. */
    USHORT usincludesubmenus; /* Include submenus indicator. */

param2
    USHORT usattributemask; /* Attribute mask. */
    USHORT usattributedata; /* Attribute data. */

Parameters

usitem (USHORT) - input
Item identifier.
usincludesubmenus (USHORT) - input
Include submenus indicator.
TRUE: If the menu does not have an item with the specified identifier, search the submenus and subdialogs of the menu for an item with the specified identifier and set its attributes.
FALSE: If the menu does not have an item with the specified identifier, do not search the submenus and subdialogs of the menu for an item with the specified identifier.
usattributemask (USHORT) - input
Attribute mask.
usattributedata (USHORT) - input
Attribute data.

Returns

rc (BOOL) - returns
Success indicator.
TRUE: Successful completion
FALSE: Error occurred

Remarks

The menu control window procedure responds to this message by setting the state of the specified attributes for the identified item.

Note: It must be sent, not posted, to the menu control.

Default Processing

The default window procedure does not expect to receive this message and therefore takes no action on it, other than to set rc to the default value of FALSE.

Examples

This example sends an MM_SETITEMATTR message to set the IDM_LARGE menu item's state to checked, and then sends another MM_SETITEMATTR message to set the IDM_MEDIUM menu item's state to unchecked.

WinSendMsg(hwndActionBar, MM_SETITEMATTR,
    MPFROM2SHORT(IDM_LARGE, TRUE),
    MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED));
WinSendMsg(hwndActionBar, MM_SETITEMATTR,
    MPFROM2SHORT(IDM_MEDIUM, TRUE),
    MPFROM2SHORT(MIA_CHECKED, FALSE));