Help Center

CRichEdit.FormatRangemethod

Formats a range of text in a rich edit control for a specific device.

Windowsmethoddocumented

Syntax

FUNCTION FormatRange (BYVAL hRichEdit AS HWND, BYVAL fRender AS LONG, BYVAL lpfr AS FORMATRANGE PTR) AS DWORD

Parameters

NameDescription
hRichEditThe handle of the rich edit control.
fRenderSpecifies whether to render the text. If this parameter is not zero, the text is rendered. Otherwise, the text is just measured.
lpfrA pointer to a FORMATRANGE structure containing information about the output device, or NULL to free information cached by the control.

Return value

This message returns the index of the last character that fits in the region, plus 1.

Description

Formats a range of text in a rich edit control for a specific device.

Remarks

This message is typically used to format the content of rich edit control for an output device such as a printer.

After using this message to format a range of text, it is important that you free cached information by sending EM_FORMATRANGE again, but with lParam set to NULL; otherwise, a memory leak will occur. Also, after using this message for one device, you must free cached information before using it again for a different device.

Reference

  • Defined in AfxNova/CRichEdit.inc:349
  • Documented in Windows/WIndows Controls/CRichEdit Class.md
  • Topic: CRichEdit Class