CProgressCtrl::Create

Creates a progress bar control and attaches it to a CProgressCtrl object.

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

Parameters

  • dwStyle
    Specifies the progress bar control's style. Apply any combination of window stylesdescribed in CreateWindow in the Windows SDK, in addition to the following progress bar control styles, to the control:

    • PBS_VERTICAL   Displays progress information vertically, top to bottom. Without this flag, the progress bar control displays horizontally, left to right.

    • PBS_SMOOTH   Displays gradual, smooth filling in the progress bar control. Without this flag, the control will fill with blocks.

  • rect
    Specifies the progress bar control's size and position. It can be either a CRect object or a RECT structure. Because the control must be a child window, the specified coordinates are relative to the client area of the pParentWnd.

  • pParentWnd
    Specifies the progress bar control's parent window, usually a CDialog. It must not be NULL.

  • nID
    Specifies the progress bar control's ID.

Return Value

TRUE if the CProgressCtrl object is successfully created; otherwise FALSE.

Remarks

You construct a CProgressCtrl object in two steps. First, call the constructor, which creates the CProgressCtrl object, and then call Create, which creates the progress bar control.

Example

CProgressCtrl myCtrl;

// Create a smooth child progress control.
myCtrl.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH, CRect(10,10,200,30), 
   pParentWnd, IDC_PROGRESSCTRL);   

Requirements

Header: afxcmn.h

See Also

Concepts

CProgressCtrl Class

CProgressCtrl Members

Hierarchy Chart

CProgressCtrl::CProgressCtrl

CProgressCtrl::CreateEx