int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// *** creation of ToolBar starts, just remark/delete the whole block if you dont't want it
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))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// *** creation of ToolBar ends -------------------------------------------------------
// *** creation of StatusBar starts, just remark/delete the whole block if you dont't want it
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// *** creation of StatusBar ends -------------------------------------------------------
// *** you have to remark/delete these lines too, if you removed the ToolBar above
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
// *** ToolBar extra ends -------------------------------------------------------
return 0;
3 回答
ToolBar
和StatusBar
的创建位于CMainFrame
类中 . 如果您不需要它们,可以轻松删除它们,如下所示:}
在
m_pMainWnd->ShowWindow(SW_SHOW);
文件中调用m_pMainWnd->SetMenu(NULL);
之前的m_pMainWnd->ShowWindow(SW_SHOW);
.转到资源文件,双击它,找到工具栏,右键单击它并选择删除:)