This example posts a Set menu item checked attribute message (MM_SETITEMATTR) to the specified message queue 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                           */
HMQ     hmq;            /* message queue handle                 */
MPARAM  mp1;            /* Parameter 1 (rectl structure)        */
MPARAM  mp2;            /* Parameter 2 (frame boolean)          */
USHORT  usItemId;       /* menu item id                         */

case WM_MENUSELECT:
     usItemId = SHORT1FROMMP(mp1);

     /* initialize message id, parameters */
     ulMsgid = MM_SETITEMATTR;
     mp1 = MPFROM2SHORT(usItemId, TRUE);
     mp2 = MPFROM2SHORT(MIA_CHECKED, TRUE);

     fResult = WinPostQueueMsg(hmq, ulMsgid, mp1, mp2);


[Back] [Next]