CCheckListBox::Create

Creates the Windows checklist box and attaches it to the CCheckListBox object.

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

Parameters

  • dwStyle
    Specifies the style of the checklist box. The style must be LBS_HASSTRINGS and either LBS_OWNERDRAWFIXED (all items in the list are the same height) or LBS_OWNERDRAWVARIABLE (items in the list are of varying heights). This style can be combined with other list-box styles except LBS_USETABSTOPS.

  • rect
    Specifies the checklist-box size and position. Can be either a CRect object or a RECT structure.

  • pParentWnd
    Specifies the checklist box's parent window (usually a CDialog object). It must not be NULL.

  • nID
    Specifies the checklist box's control ID.

Return Value

Nonzero if successful; otherwise 0.

Remarks

You construct a CCheckListBox object in two steps. First, define a class derived from CcheckListBox and then call Create, which initializes the Windows checklist box and attaches it to the CCheckListBox. See CCheckListBox::CCheckListBox for a sample.

When Create executes, Windows sends the WM_NCCREATE, WM_CREATE, WM_NCCALCSIZE, and WM_GETMINMAXINFO messages to the checklist-box control.

These messages are handled by default by the OnNcCreate, OnCreate, OnNcCalcSize, and OnGetMinMaxInfo member functions in the CWnd base class. To extend the default message handling, add a message map to the your derived class and override the preceding message-handler member functions. Override OnCreate, for example, to perform needed initialization for a new class.

Apply the following window styles to a checklist-box control:

  • WS_CHILD   Always

  • WS_VISIBLE   Usually

  • WS_DISABLED   Rarely

  • WS_VSCROLL   To add a vertical scroll bar

  • WS_HSCROLL   To add a horizontal scroll bar

  • WS_GROUP   To group controls

  • WS_TABSTOP   To allow tabbing to this control

Requirements

Header: afxwin.h

See Also

Reference

CCheckListBox Class

Hierarchy Chart

CCheckListBox::CCheckListBox

Other Resources

CCheckListBox Members