Problem in Disable System menu
-
Hi, In my project i want to disable and enable Main Menu at run time using mfc . I had try to run the following code, but don't send error occurred CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Please help me How to Disable/Enable Main Menu using View class
-
Hi, In my project i want to disable and enable Main Menu at run time using mfc . I had try to run the following code, but don't send error occurred CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Please help me How to Disable/Enable Main Menu using View class
I don't think we can work on Menus using View object. try to get the MainWindow handle and use that handle for obtaining menus. CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Try this and i hope this will work fine.
-
I don't think we can work on Menus using View object. try to get the MainWindow handle and use that handle for obtaining menus. CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED); Try this and i hope this will work fine.
Hi I had work with following code in view class, but Debug assertion failed had occured. code: CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);
-
Hi I had work with following code in view class, but Debug assertion failed had occured. code: CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);
mohindar_kks wrote:
...but Debug assertion failed had occured.
What line of what file is asserting?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
mohindar_kks wrote:
...but Debug assertion failed had occured.
What line of what file is asserting?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
Hi I had solved Debug assertion failed problem. Problem : Not disable menu with gray color from the following code code: CWnd* wnd=AfxGetMainWnd(); CMenu* mmenu = wnd->GetMenu(); CMenu* submenu = mmenu->GetSubMenu(0); submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);