ITextRange::GetChar method (tom.h)
Gets the character at the start position of the range.
Syntax
HRESULT GetChar(
long *pChar
);
Parameters
pChar
Type: long*
The start character position of the range.
Return value
Type: HRESULT
The method returns an HRESULT value. If the method succeeds, it returns S_OK. If pChar is null, the method fails and it returns E_INVALIDARG.
Remarks
The following Microsoft Visual Basic example sets ch equal to the character at the start of the range.
ch = r.Char
Similarly, ITextRange::SetChar overwrites the character at the start of the range with the specified character. The characters retrieved and set by these methods are LONG variables, which hide the way that they are stored in the backing store (as bytes, words, variable-length, and so forth), and they do not require using a BSTR.
The Char property, which can do most things that a characters collection can, has two big advantages:
- It can reference any character in the parent story instead of being limited to the parent range.
- It is significantly faster, since LONGs are involved instead of range objects.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | tom.h |
DLL | Msftedit.dll |
See also
Conceptual
Reference