ITextRange2::GetChar2 method

Gets the character at the specified offset from the end of this range.

Syntax


HRESULT GetChar2(
  [out]  long *pChar,
  [in]   long Offset
);

Parameters

pChar [out]

Type: long*

The character value.

Offset [in]

Type: long

The offset from the end of the range. An offset of 0 gets the character at the end of the range.

Return value

Type: HRESULT

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.

Remarks

This method differs from ITextRange::GetChar in the following ways:

  • It returns the UTF-32 character for the surrogate pair instead of the pair's lead code.
  • It gets the character code, or codes, at the specified offset from the end of the range instead of the character at the start of the range.

If the character is the lead code for a surrogate pair, the corresponding UTF-32 character is returned.

If Offset specifies a character before the start of the story or at the end of the story, this method returns the character code 0.

If the Offset value isThis character is returned
0The character at the end of the range.
Negative and accesses the middle of a surrogate pairThe corresponding UTF-32 character.
Positive and accesses the middle of a surrogate pairThe UTF-32 character following that pair.

 

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Tom.h

DLL

Msftedit.dll

See also

ITextRange2

 

 

Community Additions

ADD
Show:
© 2015 Microsoft