EM_FORMATRANGE message

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

Parameters

wParam

Specifies whether to render the text. If this parameter is not zero, the text is rendered. Otherwise, the text is just measured.

lParam

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.

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.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Richedit.h

See also

Reference

EM_DISPLAYBAND

Conceptual

Printing Rich Edit Controls