Jump to content

MM QUERYITEMATTR

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

This message returns the attributes of a menu item.

Syntax

param1
    USHORT usitem;            /* Item identity. */
    USHORT usIncludeSubmenus; /* Include submenus indicator. */

param2
    USHORT usattributemask; /* Attribute mask. */

Parameters

usitem (USHORT) - input
Item identity.
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 return its state.
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.

Returns

usState (USHORT) - returns
State.

Remarks

The menu control responds to this message by returning the state of the specified attributes of the identified menu item.

Default Processing

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

Examples

This example sends an MM_QUERYITEMATTR message to find the state of the 'idCase' menu item. It then toggles the state of the item and sends an MM_SETITEMATTR message to set the new state.

sState = (SHORT) WinSendMsg(hwndMenu, MM_QUERYITEMATTR,
MPFROM2SHORT(idCase, TRUE), MPFROMSHORT(MIA_CHECKED));
sState ^= MIA_CHECKED;
WinSendMsg(hwndMenu, MM_SETITEMATTR, MPFROM2SHORT(idCase, TRUE),
MPFROM2SHORT(MIA_CHECKED, sState));