How to change text of the menu item?
-
Hello all, How can i change text of the particular menu item in MFC? I have id of that menu item. Please let me know if you have any idea. Regards,
Manish Patel. B.E. - Information Technology.
-
Hello all, How can i change text of the particular menu item in MFC? I have id of that menu item. Please let me know if you have any idea. Regards,
Manish Patel. B.E. - Information Technology.
Have a look at CMenu::ModifyMenu
- NS - [ODBaseBtn]
-
Have a look at CMenu::ModifyMenu
- NS - [ODBaseBtn]
Thanks for quick reply, I have seen that function. It runs fine but i am not able to see any change to the text of the menu item. Is there any rule to use this function, If so then please let me know. Let me know if you have any other solution. Thanks and Regards,
Manish Patel. B.E. - Information Technology.
-
Thanks for quick reply, I have seen that function. It runs fine but i am not able to see any change to the text of the menu item. Is there any rule to use this function, If so then please let me know. Let me know if you have any other solution. Thanks and Regards,
Manish Patel. B.E. - Information Technology.
Sample: CMenu* pMenu = GetMenu(); pMenu->ModifyMenu( ID_FILE_SAVE, 0, ID_FILE_SAVE, "New Save" );
- NS - [ODBaseBtn]
-
Sample: CMenu* pMenu = GetMenu(); pMenu->ModifyMenu( ID_FILE_SAVE, 0, ID_FILE_SAVE, "New Save" );
- NS - [ODBaseBtn]
Sorry but i am not able to use it with System Tray popup menu. Actually i have used this library to create a System Tray pop up menu. http://www.codeproject.com/KB/shell/systemtray.aspx[^] So, Do you have any idea on this? Regards,
Manish Patel. B.E. - Information Technology.
-
Sorry but i am not able to use it with System Tray popup menu. Actually i have used this library to create a System Tray pop up menu. http://www.codeproject.com/KB/shell/systemtray.aspx[^] So, Do you have any idea on this? Regards,
Manish Patel. B.E. - Information Technology.
I am not familiar with that library. Anyway if you have the menu handle, then you can surely update it. But I could find a BOOL SetMenuText(UINT uiCmd, LPCTSTR szText); in the documentation... Did you try that?
- NS - [ODBaseBtn]
-
Hello all, How can i change text of the particular menu item in MFC? I have id of that menu item. Please let me know if you have any idea. Regards,
Manish Patel. B.E. - Information Technology.
You can add a UI handler for the menu item
ON_UPDATE_COMMAND_UI
and do something likevoid CYourClass::OnUpdateYourMenuItem(CCmdUI* pCmdUI)
{
pCmdUI->SetText("New Menu Text");
} -
You can add a UI handler for the menu item
ON_UPDATE_COMMAND_UI
and do something likevoid CYourClass::OnUpdateYourMenuItem(CCmdUI* pCmdUI)
{
pCmdUI->SetText("New Menu Text");
}Wanted to say, thanks for posting this. I had been scratching my head trying to figure out how to do this and was making it a far more difficult chore than it needed to be. This was the answer, so simple that I hadn't even considered it. worked perfectly by the way.
Mike - typical white guy. "Political correctness is a doctrine, fostered by a delusional, illogical minority, and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a piece of shit by the clean end." Thomas Mann - "Tolerance becomes a crime when applied to evil." As American as: hot dogs, apple and Sarah Palin.