VC 修改主菜单和子菜单的文本


在需要调整菜单的子函数内加入

  1. // ======= 更新菜单 ===================================   
    //更改主菜单  
    AfxGetMainWnd()->GetMenu()->ModifyMenu(0, MF_BYPOSITION, 0, _T("文件(&F)"));  
    AfxGetMainWnd()->GetMenu()->ModifyMenu(1, MF_BYPOSITION, 1, _T("配置(&C)"));  
    AfxGetMainWnd()->GetMenu()->ModifyMenu(2, MF_BYPOSITION, 2, _T("帮助(&H)"));   
    //更改子菜单  
    CMenu *subMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu(0); //第1列菜单
    subMenu->ModifyMenu(0, MF_BYPOSITION, ID_ExitApp, _T("退出(&X)"));   
    subMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu(1);  //第2列菜单
    subMenu->ModifyMenu(0, MF_BYPOSITION, ID_COM_CONFIG, _T("串口配置(&S)"));
    subMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu(2);  //第3列菜单
    subMenu->ModifyMenu(0, MF_BYPOSITION, ID_HELP_INSTRUCTION, _T("Inverter Monitor使用说明(&I)"));
    subMenu->ModifyMenu(1, MF_BYPOSITION, ID_APP_ABOUT, _T("关于Inverter Monitor(&A)..."));
    AfxGetMainWnd()->DrawMenuBar();//刷新
  2.  

你可能感兴趣的:(MFC学习)