Click here to Skip to main content
13,085,613 members (90,805 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am developing using VC++ 2010, have an MDI application using tabbed documents using the Ribbon Bar Office 2007 style Fluent UI.

I changed the CMFCRibbonStatusBar to CMFCStatusBar in the Main Frame class (because the extended panel text on the right disappeared when the frame size became smaller than the text - the CMFCStatusBar status bar just truncates the text which is what I needed.)

I also have a status bar for the Child Frame that is a CMFCStatusBar. This status bar is shown and hidden using ShowWindow(SW_SHOW/SW_HIDE). After showing/hiding the status bar, it does not re-display in the child frame until you physically resize the main frame using the resize bars.

I have tried several things after the Show/Hide statement with no joy:

RecalcLayout(); (the child frame gives and unhandled exception because you are not supposed to resize the child frame when tabbed documents are used)
AfxGetMainWnd()->PostMessage(WM_SIZE, 0, 0);

In the old days of VC++ 6.0 we could use CStatusBar and ShowControlBar() which worked great! Unfortunately, the CStatusBar class does not work when you have the Ribbon Bar so we have to use CMFCStatusBar. The MFC version does not have an equivalent to ShowControlBar()...

Any suggestions would be helpful!
Posted 11-Feb-11 7:21am
Updated 11-Feb-11 7:36am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

MSDN says you should try CBasePane::ShowPane()[^]

This method shows or hides a pane. Use this method instead of ShowWindow because this method notifies the relevant docking managers about changes in the pane's visibility.
Sharon F 11-Feb-11 19:12pm
This works when hiding but when showing, the program crashes on the first line of the CWnd::MoveWindow() function that is called from AdjustDockinglayout() in CBasePane::ShowPane() with an unhandled exception. (My guess is this is caused when it trys to resize the child frame when tabbed documents are used in an MDI app.)
Niklas Lindquist 12-Feb-11 2:42am
One idea would be to try this in a fresh project, and see if the framework is responsible for this, or if it's any code you added that might be the culprit.
Sharon F 14-Feb-11 13:06pm
I did try your idea of a fresh project and it seemed to work nicely. I'll keep looking at my code.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can also change the positions[^] of the frame's components,
so the position rectangle of a bar/view/.. could have its height =0 or not... :)
Sharon F 14-Feb-11 13:11pm
This one seemed to work OK however it left an empty space when it was disabled (0 height). See my solution below - it just needed the size message to get to the right part of the frame work to readjust the child frame. Thank you for your help!
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I ended up getting it to work by posting a WM_SIZE message to the ChildFrame just after the Show/Hide.


Thank you Niklas and Eugen for your helpful suggestions!
Rate this: bad
Please Sign up or sign in to vote.

Solution 5


I don't have an answer but did you resolve this ?

I am using vs2013 and now use cmfcstatusbar too. I overrode the onmdiclienterasebackground to draw my own background and that has caused the same behaviour as you. If I revert to normal program behaviours the status bar shows immediately..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 16 May 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100