共用方式為


CEdit::SetSel

Call this function to select a range of characters in an edit control.

void SetSel(
   DWORD dwSelection,
   BOOL bNoScroll = FALSE 
);
void SetSel(
   int nStartChar,
   int nEndChar,
   BOOL bNoScroll = FALSE 
);

Parameters

  • dwSelection
    Specifies the starting position in the low-order word and the ending position in the high-order word. If the low-order word is 0 and the high-order word is –1, all the text in the edit control is selected. If the low-order word is –1, any current selection is removed.

  • bNoScroll
    Indicates whether the caret should be scrolled into view. If FALSE, the caret is scrolled into view. If TRUE, the caret is not scrolled into view.

  • nStartChar
    Specifies the starting position. If nStartChar is 0 and nEndChar is –1, all the text in the edit control is selected. If nStartChar is –1, any current selection is removed.

  • nEndChar
    Specifies the ending position.

Remarks

For more information, see EM_SETSEL in the Windows SDK.

Example

See the example for CEdit::GetSel.

Requirements

Header: afxwin.h

See Also

Reference

CEdit Class

Hierarchy Chart

CEdit::GetSel

CEdit::ReplaceSel

Other Resources

CEdit Members