Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CComboBox::Create
◄CComboBox► ◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID );
Parameter Description
<dwStyle> Specifies the ◄style► of the combo 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
or CModalDialog). It must not be NULL.
<nID> Specifies the combo box's resource 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.
To handle Windows notification messages sent from a CComboBox object to
its parent, add any of the following message-map entries that you want
processed to the parent-class message map:
ON_COMMAND
ON_CBN_KILLFOCUS
ON_CBN_SETFOCUS
ON_CBN_DROPDOWN
ON_CBN_DBLCLK
ON_CBN_ERRSPACE
ON_CBN_SELCHANGE
ON_CBN_EDITCHANGE
ON_CBN_EDITUPDATE
Apply the following ◄window styles► to a combo-box control:
Style Application
WS_CHILD Always.
WS_VISIBLE Usually.
WS_DIABLED Rarely.
WS_VSCROLL For list boxes and combo boxes.
WS_HSCROLL For list boxes and combo boxes.
WS_GROUP To group controls.
WS_TABSTOP To include the combo box in the tabbing order.
Apply any combination of ◄combo-box styles► to the combo box.
Return Value
Returns TRUE if successful; otherwise FALSE.
See Also
◄CComboBox::CComboBox►
-♦-