Problems with ModifyMenu
Amir Salzberg -- amirfalz@netvision.net.il Monday, January 06, 1997 Hi all, Environment: Visual C++ 1.52/Windows 3.1 I am using an MDI application with a normal CMenu attached to it. I changed one menu item with ModifyMenu after I got to the menu with GetMenu(). However, it losses the attachment with the rest of the application, meaning, it leaves the status bar empty instead of showing the string attached to the menu item and more than that, it does not run the function attached to the item with ON_COMMAND. It seems to me, that because I modefied the menu item, it does not recognize the changed item and the compiler does not attach the menu item to it's original ID number in the string table. How can I attach the modified item to it's original ID, so the related ON_COMMAND function will work and the related string ID will appear in the status bar?
Pradeep -- Tamanna@albpig.cho.ge.com Tuesday, January 07, 1997 [Mini-digest: 2 responses] Hi, If u see the syntax for ModifyMenu() : BOOL ModifyMenu( UINT nPosition, UINT nFlags, UINT nIDNewItem = 0, LPCTSTR lpszNewItem = NULL ); the 3rd argument nIDNewItem may be used to specify the CommandID of the modified menu item. nPosition by default is used to specify the CommandID of the existing menu item, in which case, by specifying nIDNewItem to be the same as nPosition, you may map your modified menu item to the same ID and hence the same command handler. Pradeep ---------- From: owner-mfc-l Sent: Monday, January 06, 1997 6:36 PM To: mfc-l Subject: Problems with ModifyMenu Hi all, Environment: Visual C++ 1.52/Windows 3.1 I am using an MDI application with a normal CMenu attached to it. I changed one menu item with ModifyMenu after I got to the menu with GetMenu(). However, it losses the attachment with the rest of the application, meaning, it leaves the status bar empty instead of showing the string attached to the menu item and more than that, it does not run the function attached to the item with ON_COMMAND. It seems to me, that because I modefied the menu item, it does not recognize the changed item and the compiler does not attach the menu item to it's original ID number in the string table. How can I attach the modified item to it's original ID, so the related ON_COMMAND function will work and the related string ID will appear in the status bar? -----From: hou@tfn.com (Bing Hou) Did you call DrawMenuBar after you modified the menu? ______________________________ Reply Separator _________________________________ Subject: Problems with ModifyMenu Author: Amir Salzbergat Internet Date: 1/6/97 6:36 PM Hi all, Environment: Visual C++ 1.52/Windows 3.1 I am using an MDI application with a normal CMenu attached to it. I changed one menu item with ModifyMenu after I got to the menu with GetMenu(). However, it losses the attachment with the rest of the application, meaning, it leaves the status bar empty instead of showing the string attached to the menu item and more than that, it does not run the function attached to the item with ON_COMMAND. It seems to me, that because I modefied the menu item, it does not recognize the changed item and the compiler does not attach the menu item to it's original ID number in the string table. How can I attach the modified item to it's original ID, so the related ON_COMMAND function will work and the related string ID will appear in the status bar?
| Вернуться в корень Архива |