Click here to Skip to main content
15,894,405 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: modeless dialog and GetParent() Pin
Chris Losinger14-Sep-05 3:47
professionalChris Losinger14-Sep-05 3:47 
GeneralRe: modeless dialog and GetParent() Pin
23_44414-Sep-05 3:50
23_44414-Sep-05 3:50 
GeneralRe: modeless dialog and GetParent() Pin
Chris Losinger14-Sep-05 4:02
professionalChris Losinger14-Sep-05 4:02 
GeneralRe: modeless dialog and GetParent() Pin
23_44414-Sep-05 4:06
23_44414-Sep-05 4:06 
GeneralRe: modeless dialog and GetParent() Pin
Chris Losinger14-Sep-05 4:12
professionalChris Losinger14-Sep-05 4:12 
GeneralRe: modeless dialog and GetParent() Pin
23_44414-Sep-05 4:17
23_44414-Sep-05 4:17 
GeneralRe: modeless dialog and GetParent() Pin
Chris Losinger14-Sep-05 4:23
professionalChris Losinger14-Sep-05 4:23 
GeneralRe: modeless dialog and GetParent() Pin
23_44414-Sep-05 4:26
23_44414-Sep-05 4:26 
GeneralRe: modeless dialog and GetParent() Pin
David Crow14-Sep-05 4:39
David Crow14-Sep-05 4:39 
AnswerRe: modeless dialog and GetParent() Pin
David Crow14-Sep-05 4:34
David Crow14-Sep-05 4:34 
GeneralRe: modeless dialog and GetParent() Pin
23_44414-Sep-05 4:42
23_44414-Sep-05 4:42 
GeneralRe: modeless dialog and GetParent() Pin
David Crow14-Sep-05 8:30
David Crow14-Sep-05 8:30 
GeneralRe: modeless dialog and GetParent() Pin
23_44415-Sep-05 3:26
23_44415-Sep-05 3:26 
Questionbitmaps Pin
_tasleem14-Sep-05 3:19
_tasleem14-Sep-05 3:19 
AnswerRe: bitmaps Pin
M.Mehrdad.M14-Sep-05 3:28
M.Mehrdad.M14-Sep-05 3:28 
AnswerRe: bitmaps Pin
M.Mehrdad.M14-Sep-05 3:29
M.Mehrdad.M14-Sep-05 3:29 
AnswerRe: bitmaps Pin
David Crow14-Sep-05 3:39
David Crow14-Sep-05 3:39 
QuestionError in ShowWindow() function ? Pin
Amarelia14-Sep-05 3:12
Amarelia14-Sep-05 3:12 
AnswerRe: Error in ShowWindow() function ? Pin
krmed14-Sep-05 3:24
krmed14-Sep-05 3:24 
GeneralRe: Error in ShowWindow() function ? Pin
Amarelia14-Sep-05 3:44
Amarelia14-Sep-05 3:44 
AnswerRe: Error in ShowWindow() function ? Pin
kakan14-Sep-05 4:12
professionalkakan14-Sep-05 4:12 
QuestionHow to disable a menu item Pin
snprani14-Sep-05 2:50
snprani14-Sep-05 2:50 
AnswerRe: How to disable a menu item Pin
-Dy14-Sep-05 9:45
-Dy14-Sep-05 9:45 
Not exactly sure what your issue is. Is it that your code does not compile (sorry, not sure if your new to c++ / mfc or if it's just a typo)?

If your code is not getting through a compile, try:

CMenu *menu = AfxGetMainWnd()->GetMenu();<br />
if (menu)<br />
  menu->EnableMenuItem(ID,MF_BYCOMMAND|MF_DISABLED);



That should work fine.

Also, you can insert an update hander with MFC. In your message map, insert
<br />
BEGIN_MESSAGE_MAP(yourClassName, yourBaseClass)<br />
  //{{AFX_MSG_MAP(yourClassName)<br />
  // ...<br />
  ON_UPDATE_COMMAND_UI(ID /* menu resource id */, OnUpdateMyMenu) // NB: OnUpdateMyMenu has no params here...<br />
  // ...<br />
  //}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()


In your class definition insert

//{{AFX_MSG(yourClassName)<br />
afx_msg void OnUpdateMyMenu(CCmdUI *pCMDUI)<br />
//}}AFX_MSG


And the implementation:

void yourClassName::OnUpdateMyMenu(CCmdUI *pCmdUI)<br />
{<br />
  pCmdUI->Enable(FALSE /* your condition here */);<br />
}<br />



-Dy
QuestionHow to disable a menu item Pin
snprani14-Sep-05 2:46
snprani14-Sep-05 2:46 
AnswerRe: How to disable a menu item Pin
kakan14-Sep-05 2:56
professionalkakan14-Sep-05 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.