CMFCStatusBar incorrectly assumes WS_THICKFRAME and SBARS_SIZEGRIP - by Marc_75

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 641292 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/4/2011 2:25:54 AM
Access Restriction Public


MFC feature pack classes:
If you would like to create a 2nd status bar pane INSIDE of a CMdiChildWndEx class while having the feature MDI-tabs enabled (EnableMDITabbedGroups), MFC incorrectly assigns the status bar style SBARS_SIZEGRIP:

BOOL CMFCStatusBar::CreateEx(CWnd* pParentWnd, DWORD /*dwCtrlStyle*/, DWORD dwStyle, UINT nID)
	if (pParentWnd->GetStyle() & WS_THICKFRAME)
		dwStyle |= SBARS_SIZEGRIP;

Some window styles will be removed any time later. Probably these should be removed at an earlier stage to avoid this problem.

My workaround:
(class CMyFrame : pubic CMDIChildWndEx)
BOOL CMyFrame::PreCreateWindow(CREATESTRUCT& cs)
	if (m_pMDIFrame != NULL && m_pMDIFrame->IsMDITabbedGroup()) &= ~CMDIChildWndEx::m_dwExcludeStyle | WS_MAXIMIZE | WS_SYSMENU;
	return CMDIChildWndEx::PreCreateWindow(cs);

probably the code above should have been added to CMDIChildWndEx::PreCreateWindow()??
Sign in to post a comment.
Posted by Microsoft on 2/9/2011 at 3:58 PM

Thanks for the report. This issue has been fixed in MFC for the next major release of Visual Studio.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 2/4/2011 at 2:58 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(
Posted by Marc_75 on 2/4/2011 at 2:58 AM
My final workaround. Perhaps there is a better solution, but this will work. For some reason PreCreateWindow is called again, hence the statement: if (cs.hwndParent).

BOOL CMyFrame::PreCreateWindow(CREATESTRUCT& cs)
if (cs.hwndParent)
    CMDIFrameWndEx* pFrame = dynamic_cast<CMDIFrameWndEx*>(CWnd::FromHandle(cs.hwndParent));
    if (pFrame && pFrame->IsMDITabbedGroup()) &= ~CMDIChildWndEx::m_dwExcludeStyle | WS_MAXIMIZE | WS_SYSMENU;
return CMDIChildWndEx::PreCreateWindow(cs);
Posted by Marc_75 on 2/4/2011 at 2:46 AM
I'm sorry,
the if-statement in my workaround posted will not function since the m_pMDIFrame will only be set later on in CMDIChildWndEx::OnCreate(). But still, the workaround (after the if-condition) works.