Defines the selected text range in the edit control portion.
C
int WINAPI SftBox_GetEditSel(HWND hwndCtl, int* lpStartPos, int* lpEndPos); int WINAPI SftBox_SetEditSel(HWND hwndCtl, int startPos, int endPos);
C++
int CSftBox::GetEditSel(int* lpStartPos, int* lpEndPos) const; int CSftBox::SetEditSel(int startPos, int endPos);
hwndCtl
The window handle of the combo box control.
lpStartPos
A pointer to a variable which returns the zero-based position of the first selected character. -1 is returned if the combo box does not have an edit control portion.
lpEndPos
A pointer to a variable which returns the zero-based position of the first character after the selected text. -1 is returned if the combo box does not have an edit control portion.
startPos
The zero-based position of the first character to be selected.
endPos
The zero-based position of the first character after the text to be selected.
The return value is 0 if the function was successful. -1 is returned if the combo box is a dropdown list combo box, which does not have an edit control portion.
The GetEditSel and SetEditSel functions define the selected text range in the edit control portion of a simple or dropdown combo box.
If no text is selected, GetEditSel returns the position of the caret (insertion point) in both lpStartPos and lpEndPos.
SetEditSel selects the characters between startPos and endPos. If both values are the same, no text is selected and the caret is moved to the specified position. If startPos is 0 and endPos is -1, all text in the edit control portion is selected. If startPos is -1, the current selection is removed.
The selected text can be retrieved and replaced using GetSelText and SetSelText.
See Also C/C++ API | Categories | Notifications