Search code examples
mfcmfc-feature-pack

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


Solution

  • Figured out one way...

    class CNoCloseCaptionBar : public CMFCCaptionBar
    {
    public:
        CNoCloseCaptionBar()
        {
        }
    
        virtual void RecalcLayout()
        {
            __super::RecalcLayout();
            m_rectClose.SetRectEmpty();
        }
    
    };