Changing menu text on the fly in VC6.0

  • Thread starter Thread starter MorrisS
  • Start date Start date
M

MorrisS

Guest
Hello,

I'm using Visual C++ V6.0 and have the following issue. I have a menu resource with sub-menus.

Eg. File -> Example -> Demo1

File -> Example -> Demo2

I need to change the menu text during the program exectution. To do this I've used ModifyMenu() to modify the names of Demo1 and Demo2:



void CMainFrame::OnUpdate()

{

CMenu* nuMain = GetMenu();

CMenu* nuPopup;



nuPopup = nuMain->GetSubMenu(0);



// swap names as an example

nuPopup->ModifyMenu(ID_DEMO1, MF_STRING | MF_BYCOMMAND, ID_DEMO1, "Demo2");

nuPopup->ModifyMenu(ID_DEMO2, MF_STRING | MF_BYCOMMAND, ID_DEMO2, "Demo1");

}



However I am unsure how to modify the name of the parent menu item ('Example' in this case) as it has no discrete ID (in the properties window - it just a pop-up check box).



Any pointers would be appreciated.



Thanks.

Continue reading...
 
Back
Top