View Single Post
Join Date: Mar 2006
Posts: 14
Reputation: vickzbrit is an unknown quantity at this point 
Solved Threads: 0
vickzbrit vickzbrit is offline Offline
Newbie Poster

Re: Disable/Enable Menu Items and Sub Items

 
0
  #9
Nov 23rd, 2008
Originally Posted by koushal.vv View Post
Hope this works....

  1. CMainFrame* pFrame ; // Memeber variable
  2. pFrame = (CMainFrame*) AfxGetMainWnd();
  3.  
  4. pFrame->GetMenu()
  5. ->EnableMenuItem(ID_SORT_MANAGER,MF_GRAYED);

But make sure that u have set the m_bAutoMenuEnable = false;
The code that you provided here is not working. CMainFrame and pFrame is giving me errors and syntax errors too. Here is what I got right now and I still dont understand why is this not working
  1. CWnd* pParent = GetParent();
  2. CMenu* pMenu = pParent->GetMenu();
  3. CMenu* submenu = pMenu->GetSubMenu(0);
  4. submenu->EnableMenuItem(0, MF_BYPOSITION | MF_GRAYED );

Please help me out
Last edited by vickzbrit; Nov 23rd, 2008 at 4:06 pm.
Reply With Quote