What would be the easiest way of using commands in the code to programatically disable these two features in an application? Thanks in advance.
A:
Call CMenu::EnableMenuItem
with the appropriate menu items and MF_DISABLED
as the second parameter. Here's the documentation.
Traveling Tech Guy
2009-09-05 07:10:59
+3
A:
You could handle the update UI message:
ON_UPDATE_COMMAND_UI(ID_FILE_NEW, OnUpdateFileNew)
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE, OnUpdateFileSave)
...
void CMainFrame::OnUpdateFileNew(CCmdUI *pCmdUI)
{
pCmdUI->Enable( FALSE );
}
void CMainFrame::OnUpdateFileSave(CCmdUI *pCmdUI)
{
pCmdUI->Enable( FALSE );
}
Alan
2009-09-05 07:36:09
ON_COMMAND_RANGE didn't quite work well for me.
stanigator
2009-09-06 01:31:23
Ok, fixed that typo (should have properly read the code after copying from an existing project!)
Alan
2009-09-06 08:52:48