Removing close button in a CDialogBar

newton1 used Ask the Experts™
VC++ 6.0 SP3, NT4.0 SP5
I have a CDialogBar with a CPropertSheet with two PropertyPages in it. The dialogBar is dockable. What I need to do is remove the small 'x' button <close> in the upper right corner of the bar. I've tried the code from CodeGuru on removing the sysmenu from a toolbar, but nothing seems to work. I'm not even sure if this is an actual sysmenu, the close button is a lot smaller than a normal close button.
IF someone has a clue how to do this, please help!

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
What I did is this,
a) I Created my own dialogbar(CMyBar) class using class wizard(Derive it out og generic CWnd and then replace CWnd with CDialogBar)

b) Handled Left mouse button double click in this class.

c) Override Create
d) Go to the mainframe class and change the declaration of the CDialogBar object to CMyBar.

#include "Mybar.h"
class CMainFrame:....
CMyBar m_wndDialogbar;


BOOL CMyBar::Create( CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID )
      BOOL bReturn = CDialogBar::Create(pParentWnd,nIDTemplate,nStyle,nID);
      return bReturn;

void CMyBar::OnLButtonDblClk(UINT nFlags, CPoint point)
      // TODO: Add your message handler code here and/or call default
      CDialogBar::OnLButtonDblClk(nFlags, point);
            CWnd* pMiniFrame;            
            CWnd* pDockBar;
            pDockBar = GetParent();            
            pMiniFrame = pDockBar->GetParent();
            //get rid of window menu            
            pMiniFrame->ModifyStyle(WS_SYSMENU, NULL);


That's it it starts working

When your DialogBar is floating, its parent is a special frame with a mini title bar and a close button.

This frame is dynamically created by the framework using the value of the
'm_pFloatingFrameClass' pointer.

I would suggest you to modify the behaviour of this special frame and NOT your DialogBar.


Thanks a lot vcGuru!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial