
(1)如果要在视图中调用CMFC_frameView :: OnLButtonDown()(响应CView中的左按钮):
CWnd * pToolBarDlg; //父窗口(即我们想要的包含工具栏的窗口)
pToolBarDlg =(((CWnd *)((CMainFrame *)AfxGetMainWnd())-> m_wndToolBar.m_pDockBar)

-> GetParent(); // m_wndToolBar是CMainFrame中的工具栏
如果(pToolBarDlg-> IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
{

pToolBarDlg-> ModifyStyle(WS_SYSMENUmfc对话框去掉关闭按钮,0); //删除“关闭”按钮
pToolBarDlg-> SetWindowTextW(_T(“ donow”)); //可以设置标题
}

(3.2)如果要在初始化时在主窗口CMainFrame :: OnCreate()中调用它,则将从开头删除“关闭”按钮:
// M_wndToolBar.CreateEx()和m_wndToolBar.LoadToolBar(IDR_MAINFRAME)
CWnd * pToolBarDlg;
pToolBarDlg =(CWnd *)(m_wndToolBar.m_pDockBar);
pToolBarDlg = pToolBarDlg-> GetParent();
如果(pToolBarDlg-> IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
{
pToolBarDlg-> ModifyStyle(WS_SYSMENUmfc对话框去掉关闭按钮,0);
}
效果如下:
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-160171-1.html
就大陆的现状而言