Re: Menu in dialog application, CheckMenuItem [modified]
-
Dear all, I have created a dialog application using Visual C++ 2008 with a menu and I haven't been able to get a check mark to show on a menu item. In the class derived from CDialog, I declared a private member: CMenu m_menu; The menu IDR_MENU1 was loaded into the dialog using the resource editor. In the OnInitDialog function of the same class: m_menu.LoadMenuA(IDR_MENU1); When the user selects the menu item, the check should appear. The code reached after selecting the menu item: UINT j = m_menu.CheckMenuItem(ID_HELLO_CHOICE1, MF_BYCOMMAND | MF_CHECKED); The value of j is 0 after being executed the first time and 8 after being executed the second time, which is what I expected. However, I still see no check mark next to the menu item. How can I get the check mark to show? Any suggestions and help are appreciated. Regards, Mike -- Modified Friday, March 26, 2010 1:20 PM
-
Dear all, I have created a dialog application using Visual C++ 2008 with a menu and I haven't been able to get a check mark to show on a menu item. In the class derived from CDialog, I declared a private member: CMenu m_menu; The menu IDR_MENU1 was loaded into the dialog using the resource editor. In the OnInitDialog function of the same class: m_menu.LoadMenuA(IDR_MENU1); When the user selects the menu item, the check should appear. The code reached after selecting the menu item: UINT j = m_menu.CheckMenuItem(ID_HELLO_CHOICE1, MF_BYCOMMAND | MF_CHECKED); The value of j is 0 after being executed the first time and 8 after being executed the second time, which is what I expected. However, I still see no check mark next to the menu item. How can I get the check mark to show? Any suggestions and help are appreciated. Regards, Mike -- Modified Friday, March 26, 2010 1:20 PM
Dear all, I've just found an answer (funny how this happens just a few minutes after I post the question). In the class derived from CDialog, I changed m_menu to: CMenu *m_menu; In OnInitDialog, I replaced the LoadMenuA statement with: m_menu = GetMenu(); It worked! Regards, Mike