Problem in disabling menu items
-
I have an SDI application ,I want to disable toolbar and menuitems for certain users. Toolbar buttons get hidden but menu items remain as it is. I checked cmu does not get null value. this code is in MainFrame.cpp. *- Instead of m_hWnd I tried ::AfxGetMainWnd() and *- AfxGetApp()->GetMainWindow().GetMenu() but result is worse. ////////////////////////////////current code CMenu* cmu = (CMenu*)::GetMenu(m_hWnd); if(right[0] == 0) { ctb.SetState(ID_ADD_CUSTOMER,TBSTATE_HIDDEN); UINT ui = cmu->EnableMenuItem(ID_ADD_CUSTOMER,MF_DISABLED); } if(right[1] == 0) { ctb.SetState(ID_INACTIVATE_ACCOUNT,TBSTATE_HIDDEN); UINT ui = cmu->EnableMenuItem(ID_INACTIVATE_ACCOUNT,MF_GRAYED); } }
|| ART OF LIVING ||
-
I have an SDI application ,I want to disable toolbar and menuitems for certain users. Toolbar buttons get hidden but menu items remain as it is. I checked cmu does not get null value. this code is in MainFrame.cpp. *- Instead of m_hWnd I tried ::AfxGetMainWnd() and *- AfxGetApp()->GetMainWindow().GetMenu() but result is worse. ////////////////////////////////current code CMenu* cmu = (CMenu*)::GetMenu(m_hWnd); if(right[0] == 0) { ctb.SetState(ID_ADD_CUSTOMER,TBSTATE_HIDDEN); UINT ui = cmu->EnableMenuItem(ID_ADD_CUSTOMER,MF_DISABLED); } if(right[1] == 0) { ctb.SetState(ID_INACTIVATE_ACCOUNT,TBSTATE_HIDDEN); UINT ui = cmu->EnableMenuItem(ID_INACTIVATE_ACCOUNT,MF_GRAYED); } }
|| ART OF LIVING ||
What was the return value
EnableMenuItem
?
WhiteSky