Brad Robinson
Brad Robinson

Reputation: 46877

How to remove the close button from an MFC caption bar

Is there an easy way to remove the close button from an MFC feature pack caption bar?

(I don't mean the window caption, I'm talking about the little information bar that can appear at the top of the client area in these apps - ie:CMFCCaptionBar)

Thanks

Upvotes: 4

Views: 2575

Answers (2)

ASooter
ASooter

Reputation: 1

Removing the bitmap worked for me. See the MSOffice2007Demo example in the Visual C++ 2008 Feature Pack.

Comment out the following line in CMainFrame:CreateMessageBar()

//m_wndMessageBar.SetBitmap(IDB_INFO, RGB(255, 255, 255), FALSE, CMFCCaptionBar::ALIGN_LEFT);

Caption Bar without close button enter image description here

Upvotes: 0

Brad Robinson
Brad Robinson

Reputation: 46877

Figured out one way...

class CNoCloseCaptionBar : public CMFCCaptionBar
{
public:
    CNoCloseCaptionBar()
    {
    }

    virtual void RecalcLayout()
    {
        __super::RecalcLayout();
        m_rectClose.SetRectEmpty();
    }

};

Upvotes: 3

Related Questions