This example uses WinIsMenuItemChecked to query the check attribute of a selected menu item before setting the check state of that menu item.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #include <os2.h> USHORT usItemId; /* Menu item ID */ HWND hwndMenu; /* Menu handle */ BOOL usChkstate; /* New checked state */ BOOL fSuccess; /* Success indicator */ MPARAM mp1; /* Parameter 1 (menu item ID) */ MPARAM mp2; /* Parameter 2 (menu handle) */ case WM_MENUSELECT: usItemId = SHORT1FROMMP(mp1); hwndMenu = HWNDFROMMP(mp2); /* Query the current check state */ usChkstate = WinIsMenuItemChecked(hwndMenu, usItemId); /* Set the menu item check state */ fSuccess = WinCheckMenuItem(hwndMenu, usItemId, usChkstate);