CComboBox::Create

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

Return Value

Nonzero if successful; otherwise 0.

Parameters

dwStyle

Specifies the style of the combo box. Apply any combination of combo-box styles to the box. 

rect

Points to the position and size of the combo box. Can be a RECT structure or a CRect object.

pParentWnd

Specifies the combo box’s parent window (usually a CDialog). It must not be NULL.

nID

Specifies the combo box’s control ID.

Remarks

You construct a CComboBox object in two steps. First call the constructor, then call Create, which creates the Windows combo box and attaches it to the CComboBox object.

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

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, derive a class from CComboBox, add a message map to the new 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 combo-box control. :

Example

// pParentWnd is an external pointer to the parent window.
extern CWnd* pParentWnd;
// The pointer to my combo box.
extern CComboBox* pmyComboBox;

pmyComboBox->Create(
      WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST,
      CRect(10,10,200,100), pParentWnd, 1);

CComboBox OverviewClass MembersHierarchy Chart

See Also   CComboBox::CComboBox, Combo-Box Styles