CStatusBarCtrl::Create

Creates a status bar control and attaches it to a CStatusBarCtrl object.

virtual BOOL Create( 
   DWORD dwStyle, 
   const RECT& rect, 
   CWnd* pParentWnd, 
   UINT nID  
);

Parameters

  • dwStyle
    Specifies the status bar control's style. Apply any combination of status bar control styles listed in Common Control Styles in the Windows SDK. This parameter must include the WS_CHILD style. It should also include the WS_VISIBLE style.

  • rect
    Specifies the status bar control's size and position. It can be either a CRect object or a RECT 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.

Return Value

Nonzero if successful; otherwise zero.

Remarks

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

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.

To create a status bar with extended window styles, call CStatusBarCtrl::CreateEx instead of Create.

Example

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

Requirements

Header: afxcmn.h

See Also

Reference

CStatusBarCtrl Class

Hierarchy Chart

CStatusBarCtrl::CStatusBarCtrl