BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { cs.hMenu=NULL; if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; return TRUE; } this could delete the Menubar. However since the TopLevel window should be WS_OVERLAPPEDWINDOW sytle window by default. cs.style = WS_POPUP; or cs.style&=~WS_CAPTION; It does no effect. It maybe be attained by creating the CMainFrame as a child window of CFrameWnd then change it.However,unlike the CDialog-derived class,it is dynamicly created by CDocTemplate internally.So it is difficult to achieve this.
I am wondering why you use a CDialog based class instead??
不用CDialog baseed class 当然是有其他原因。 比如dialog的OnIdel()函数好像没有用,所以改用了formView。我用cs.hMenu = NULL;确实去掉了menuBar.用cs.style = WS_POPUP;确实又去掉了titleBar. 用cs.style&=~WS_CAPTION;好像就没有什么用处,不知道为什么。这样用效果是达到了,不知道有什么后果
{
..............
cs.hMenu = NULL;}
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
}
给去掉
就没有工具栏了
{
cs.hMenu=NULL;
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
this could delete the Menubar.
However since the TopLevel window should be WS_OVERLAPPEDWINDOW sytle window by default.
cs.style = WS_POPUP;
or
cs.style&=~WS_CAPTION;
It does no effect.
It maybe be attained by creating the CMainFrame
as a child window of CFrameWnd then change it.However,unlike the CDialog-derived class,it is dynamicly created by CDocTemplate internally.So it is difficult to achieve this.
比如dialog的OnIdel()函数好像没有用,所以改用了formView。我用cs.hMenu = NULL;确实去掉了menuBar.用cs.style = WS_POPUP;确实又去掉了titleBar.
用cs.style&=~WS_CAPTION;好像就没有什么用处,不知道为什么。这样用效果是达到了,不知道有什么后果
去掉菜单条的标准做法是SetMenu(NULL),利用cs.hMenu=NULL在
单文档的程序中还可以,在多文档的程序中会报错!