共用方式為


CComboBox::SetEditSel

Selects characters in the edit control of a combo box.

BOOL SetEditSel( 
   int nStartChar, 
   int nEndChar  
);

Parameters

  • nStartChar
    Specifies the starting position. If the starting position is set to –1, then any existing selection is removed.

  • nEndChar
    Specifies the ending position. If the ending position is set to –1, then all text from the starting position to the last character in the edit control is selected.

Return Value

Nonzero if the member function is successful; otherwise 0. It is CB_ERR if CComboBox has the CBS_DROPDOWNLIST style or does not have a list box.

Remarks

The positions are zero-based. To select the first character of the edit control, you specify a starting position of 0. The ending position is for the character just after the last character to select. For example, to select the first four characters of the edit control, you would use a starting position of 0 and an ending position of 4.

Note

This function is not supported by the Windows ComboBoxEx control. For more information on this control, see ComboBoxEx Controls in the Windows SDK.

Example

See the example for CComboBox::GetEditSel.

Requirements

Header: afxwin.h

See Also

Reference

CComboBox Class

Hierarchy Chart

CComboBox::GetEditSel

CB_SETEDITSEL