Share via


CStatusBarCtrl::Create

BOOLCreate(DWORDdwStyle**,constRECT&rect,CWnd*pParentWnd,UINTnID);**

Return Value

Nonzero if successful; otherwise zero.

Parameters

dwStyle   Specifies the status bar control’s style. Apply any combination of status bar control styles to the control. This parameter must include the WS_CHILD style. It should also include the WS_VISIBLE style. See the Remarks section for more information.

rect

Specifies the status bar control’s size and position. It can be either a CRect object or a structure.

pParentWnd

Specifies the status bar control’s parent window, usually a CDialog. It must not be NULL.

nID

Specifies the status bar control’s ID.

Remarks

You construct a CStatusBarCtrl in two steps. First call the constructor, then call Create, which creates the status bar control and attaches it to the CStatusBarCtrl object.

The dwStyle parameter can have any combination of the following values:

  • CCS_BOTTOM   Causes the control to position itself at the bottom of the parent window’s client area and sets the width to be the same as the parent window’s width. Status bar controls have this style by default.

  • CCS_NODIVIDER   Prevents a two-pixel highlight from being drawn at the top of the control.

  • CCS_NOHILITE   Prevents a one-pixel highlight from being drawn at the top of the control.

  • CCS_NOMOVEY   Causes the control to resize and move itself horizontally, but not vertically, in response to a WM_SIZE message. If the CCS_NORESIZE style is used, this style does not apply.

  • CCS_NOPARENTALIGN   Prevents the control from automatically moving to the top or bottom of the parent window. Instead, the control keeps its position within the parent window despite changes to the size of the parent window. If the CCS_TOP or CCS_BOTTOM style is also used, the height is adjusted to the default, but the position and width remain unchanged.

  • CCS_NORESIZE   Prevents the control from using the default width and height when setting its initial size or a new size. Instead, the control uses the width and height specified in the request for creation or sizing.

  • CCS_TOP   Causes the control to position itself at the top of the parent window’s client area and sets the width to be the same as the parent window’s width.

The default position of a status window is along the bottom of the parent window, but you can specify the CCS_TOP style to have it appear at the top of the parent window’s client area. You can specify the SBARS_SIZEGRIP style to include a sizing grip at the right end of the status window. Combining the CCS_TOP and SBARS_SIZEGRIP styles is not recommended, because the resulting sizing grip is not functional even though the system draws it in the status window.

Example

VERIFY( m_wndSBC.Create(WS_CHILD|WS_VISIBLE|CCS_BOTTOM|SBARS_SIZEGRIP,
          CRect(0,0,0,0), this, IDC_STATUS_BAR) );

CStatusBarCtrl OverviewClass MembersHierarchy Chart

See Also   CStatusBarCtrl::CStatusBarCtrl