ITextProvider::GetSelection method
Retrieves a collection of text ranges that represents the currently selected text in a text-based control.
Syntax
HRESULT GetSelection( [out, retval] SAFEARRAY **pRetVal );
Parameters
- pRetVal [out, retval]
-
Type: SAFEARRAY**
Receives the address of an array of pointers to the ITextRangeProvider interfaces of the text ranges, one for each selected span of text. This parameter is passed uninitialized.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
For UI Automation providers that support text selection, the provider should implement this method and also return a ITextProvider::SupportedTextSelection value.
If the control contains only a single span of selected text, the pRetVal array should contain a single text range.
If the control contains a text insertion point but no text is selected, the pRetVal array should contain a degenerate (empty) text range at the position of the text insertion point.
If the control contains no selected text, or if the control does not contain a text insertion point, set pRetVal to NULL.
Requirements
|
Minimum supported client |
Windows XP [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps | Windows Store apps] |
|
Header |
|
|
IDL |
|
See also
- Reference
- ITextProvider
- ITextRangeProvider
- Conceptual
- UI Automation Providers Overview
- Best Practices for Using Safe Arrays