CMenu* pMenu =GetMenu();
pMenu->DeleteMenu(1,MF_BYCOMMAND);CMenu menu;
menu.LoadMenu(IDR_MYMENU);
SetMenu(&menu);  
menu.Detach();
想删除系统菜单(FILE VIEW....),再加载自己的菜单,可是系统提示错误
{ ASSERT(::IsMenu(m_hMenu)); return ::DeleteMenu(m_hMenu, nPosition, nFlags); }
我用SetMenu(NULL); 也不起作用。
GetSystemMenu()不起作用求如何删除菜单。。

解决方案 »

  1.   

    用标志MF_BYPOSITION,不要用MF_BYCOMMAND
      

  2.   

    楼上的老兄说的很准确了
    MF_BYCOMMAND
    Indicates that the uPosition parameter gives the identifier of the menu item. The MF_BYCOMMAND flag is the default if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified.MF_BYPOSITION
    Indicates that the uPosition parameter gives the zero-based relative position of the menu item. 
      

  3.   

    pMenu->DeleteMenu(1,MF_BYCOMMAND);
    改为
     pMenu->DeleteMenu(1,MF_BYPOSITION);主要问题是以上代码运行时机早
    把以上代码放在OnCreate事件里面