This example posts a Set menu item checked attribute message (MM_SETITEMATTR) to the message queue associated with the window handle in response to a menu select message (WM_MENUSELECT).
#define INCL_WINMESSAGEMGR /* Window Message Functions */ #define INCL_WINMENUS /* Window Menu Functions */ #include <os2.h> BOOL fResult; /* message-posted indicator */ ULONG ulMsgid; /* message id */ MPARAM mp1; /* Parameter 1 (rectl structure) */ MPARAM mp2; /* Parameter 2 (frame boolean) */ USHORT usItemId; /* menu item id */ HWND hwndMenu; /* menu handle */ case WM_MENUSELECT: usItemId = SHORT1FROMMP(mp1); hwndMenu = HWNDFROMMP(mp2); /* initialize message id, parameters */ ulMsgid = MM_SETITEMATTR; mp1 = MPFROM2SHORT(usItemId, TRUE); mp2 = MPFROM2SHORT(MIA_CHECKED, TRUE); fResult = WinPostMsg(hwndMenu, ulMsgid, mp1, mp2);