*** 如何让程序运行时不显示菜单(按钮)?

解决方案 »

  1.   

    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {  
    CMenu* pMenu=GetMenu();
    if(pMenu!=NULL)

    while(pMenu->RemoveMenu(0,MF_BYPOSITION)); 
    }  
      return 0;
    }
      

  2.   

    GetWindowRect(&m_Rect);
    if(::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,m_Rect.left,m_Rect.top,m_Rect.right,m_Rect.bottom,SWP_HIDEWINDOW|SWP_NOMOVE))
      

  3.   

    SetMenu(NULL);
    ShowWindow(SW_HIDE);
      

  4.   

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    if( !CFrameWnd::PreCreateWindow(cs) )
    return FALSE;
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs
    cs.hMenu = NULL; return TRUE;
    }
      

  5.   

    SetMenu(NULL);
    ShowWindow(SW_HIDE);
      

  6.   

    SetMenu(NULL);
    不过最好再声明一个成员变量CMenu m_menuSaved;
    需要的时候
    m_menuSaved.LoadMenu(IDR_MAINFRAME);
    SetMenu(&m_menuSaved);
    DrawMenuBar();