CB_SETEDITSEL
wParam = 0; /* not used, must be zero */
lParam = MAKELPARAM(ichStart, ichEnd); /* start and end positions */
An application sends a CB_SETEDITSEL message to select characters in the edit control of a combo box.
ichStart
Value of the low-order word of lParam. Specifies the starting position. If this parameter is set to –1, the selection, if any, is removed.
ichEnd
Value of the high-order word of lParam. Specifies the ending position. If this parameter is set to –1, all text from the starting position to the last character in the edit control is selected.
The return value is nonzero if the message is successful. It is CB_ERR if the message is sent to a combo box with the CBS_DROPDOWNLIST style.
The positions are zero-based. To select the first character of the edit control, you specify a starting position of zero. 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.
This example selects the first four characters of the edit control of a combo box:
SendDlgItemMessage
(hdlg, ID_MYCOMBOBOX, CB_SETEDITSEL, 0, MAKELONG(0, 4));