This example uses WinEnableMenuItem to make a menu item selection available when the menu is initialized (WM_INITMENU).

#define INCL_WINMESSAGEMGR      /* Window Message Functions     */
#define INCL_WINMENUS           /* Window Menu Functions        */
#include <os2.h>

BOOL    fResult;        /* message-posted indicator             */
MPARAM  mpParam1;       /* Parameter 1 (rectl structure)        */
MPARAM  mpParam2:       /* Parameter 2 (frame boolean)          */
USHORT  usItemId;       /* menu item id                         */
HWND    hwndMenu;       /* menu handle                          */

case WM_INITMENU:
     usItemId = SHORT1FROMMP(mpParam1);
     hwndMenu = HWNDFROMMP(mpParam2);

     /* enable menu item */
     fResult = WinEnableMenuItem(hwndMenu, usItemId, TRUE);


[Back] [Next]