AppendMenu()使用出错
今天使用AppendMenu()函数添加一个菜单,可是运行出错,说内存不能为read:CMenu *menu_bar=AfxGetMainWnd()->GetMenu();
CMenu *Append_item=menu_bar->GetSubMenu(0);
Append_item->AppendMenu(MF_STRING,111,"SSS");
于是改为:
GetMenu()->GetSubMenu(0)->AppendMenu(MF_STRING,111,"SSS");
运行通过,不知为什么第一种方法会出错呢???