Share via


Methods of Creating a Status Bar

OverviewSample

MFC provides two classes to create status bars: and (which wraps the Windows common control API). CStatusBar provides all of the functionality of the status bar common control, it automatically interacts with menus and toolbars, and it handles many of the required common control settings and structures for you; however, your resulting executable usually will be larger than that created by using CStatusBarCtrl.

CStatusBarCtrl usually results in a smaller executable, and you may prefer to use CStatusBarCtrl if you do not intend to integrate the status bar into the MFC architecture. If you plan to use CStatusBarCtrl and integrate the status bar into the MFC architecture, you must take additional care to communicate status bar control manipulations to MFC. This communication is not difficult; however, it is additional work that is unneeded when you use CStatusBar.

Visual C++ provides two ways to take advantage of the status bar common control.

  • Create the status bar using CStatusBar, and then call to get access to the CStatusBarCtrl member functions.

  • Create the status bar using 's constructor.

Either method will give you access to the member functions of the status bar control. When you call CStatusBar::GetStatusBarCtrl, it returns a reference to a CStatusBarCtrl object so you can use either set of member functions. See for information on constructing and creating a status bar using CStatusBar.

See Also   Windows Common Controls and MFC Classes