There are two methods:
Method 1: Reload the create function of the framework class.CodeAs follows:Copy codeThe Code is as follows: bool cmainframe: Create (maid, maid, DWORD dwstyle, const rect & rect, cwnd * pparentwnd, maid, DWORD dwexstyle, ccreatecontext * pcontext)
{
// Todo: Add dedicated code and/or call the base class here
// Return cframewnd: Create (lpszclassname, lpszwindowname, dwstyle, rect, /// pparentwnd, lpszmenuname, dwexstyle, pcontext );
Hmenu nidorhmenu = NULL;
Return cframewnd: createex (dwexstyle, lpszclassname, lpszwindowname, dwstyle,
Rect. Left, rect. Top, rect. right-rect.left, rect. bottom-rect.top,
Pparentwnd-> getsafehwnd (),
Nidorhmenu,
(Lpvoid) pcontext );
}
Method 2: manually delete all menu items. Specifically, define a function to delete all menu items:Copy codeThe Code is as follows :/*!
* \ Brief deletes all Menu Bars.
*
* Delete All Menu Bars in the window.
* \ Return none.
*/
Static void delallmenu (hmenu)
{
// Delete unnecessary menu items first
Int menucount = getmenuitemcount (hmenu );
For (INT I = Menucount-1; I>-1; I --)
{
: Deletemenu (hmenu, I, mf_byposition );
}
}
Then, call this function in the oncreate function of the framework class as follows:Copy codeThe Code is as follows: int cmainframe: oncreate (maid)
{
If (cframewnd: oncreate (lpcreatestruct) =-1)
Return-1;
If (! M_wndtoolbar.createex (this, tbstyle_flat, ws_child | ws_visible | cbrs_top
| cbrs_gripper | cbrs_tooltips | cbrs_flyby | cbrs_size_dynamic) |
! M_wndtoolbar.loadtoolbar (idr_mainframe)
{< br> trace0 ("Toolbar \ n not created");
return-1; // failed to create
}< br> If (! M_wndstatusbar.create (this) |
! M_wndstatusbar.setindicators (indicators,
sizeof (indicators)/sizeof (uint)
{< br> trace0 ("unable to create status bar \ n ");
return-1; // creation failed
}< br> // todo: You can dock a toolbar if you do not need it, delete the three rows
m_wndtoolbar.enabledocking (cbrs_align_any);
enabledocking (cbrs_align_any);
dockcontrolbar (& m_wndtoolbar );
// obtain the menu handle of the window
cmenu * pmenu = getmenu ();
If (null! = Pmenu)
{< br> delallmenu (pmenu-> getsafehmenu ();
}< br> return 0;
}