Export (0) Print
Expand All
Expand Minimize

CListCtrl::Create

Creates a list control and attaches it to a CListCtrl object.

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

Parameters

dwStyle
Specifies the list control's style. Apply any combination of list control styles to the control. See List view window styles in the Platform SDK for a complete list of these styles. Set extended styles specific to a control using SetExtendedStyle.
rect
Specifies the list control's size and position. It can be either a CRect object or a RECT structure.
pParentWnd
Specifies the list control's parent window, usually a CDialog. It must not be NULL.
nID
Specifies the list control's ID.

Return Value

Nonzero if successful; otherwise zero.

Remarks

You construct a CListCtrl in two steps. First, call the constructor and then call Create, which creates the list view control and attaches it to the CListCtrl object.

To apply extended Windows styles to the list control object, call CreateEx instead of Create.

Example

// pParentWnd is a pointer to the parent window.
extern CWnd* pParentWnd;
// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;

pmyListCtrl->Create(
   WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT,
   CRect(10,10,400,200), pParentWnd, 1);

See Also

CListCtrl Overview | Class Members | Hierarchy Chart | CListCtrl::CListCtrl | CListCtrl::CreateEx

Show:
© 2014 Microsoft