Share via


CReBar vs. CReBarCtrl

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CReBar vs. CReBarCtrl.

MFC provides two classes to create rebars: CReBar and CReBarCtrl (which wraps the Windows common control API). CReBar provides all of the functionality of the rebar common control, and it handles many of the required common control settings and structures for you.

CReBarCtrl is a wrapper class for the Win32 rebar control, and therefore may be easier to implement if you do not intend to integrate the rebar into the MFC architecture. If you plan to use CReBarCtrl and integrate the rebar into the MFC architecture, you must take additional care to communicate rebar control manipulations to MFC. This communication is not difficult; however, it is additional work that is unneeded when you use CReBar.

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

  • Create the rebar using CReBar, and then call CReBar::GetReBarCtrl to get access to the CReBarCtrl member functions.

    Note

    CReBar::GetReBarCtrl is an inline member function that casts the this pointer of the rebar object. This means that, at run time, the function call has no overhead.

  • Create the rebar using CReBarCtrl's constructor.

Either method will give you access to the member functions of the rebar control. When you call CReBar::GetReBarCtrl, it returns a reference to a CReBarCtrl object so you can use either set of member functions. See CReBar for information on constructing and creating a rebar using CReBar.

See Also

Using CReBarCtrl
Controls