• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 972
  • Last Modified:

Removing close button in a CDialogBar

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!

1 Solution
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.
newton1Author Commented:
Thanks a lot vcGuru!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now