Help Center

CRichEdit.SetTargetDevicemethod

Sets the target device and line width used for WYSIWYG formatting in a rich edit control.

Windowsmethoddocumented

Syntax

FUNCTION SetTargetDevice (BYVAL hRichEdit AS HWND, BYVAL hDC AS HDC, BYVAL lnwidth AS LONG) AS LONG

Parameters

NameDescription
hRichEditThe handle of the rich edit control.
hDCHDC [Handle to a Device Context] for the target device.
lnwidthLine width to use for formatting.

Return value

The return value is zero if the operation fails, or nonzero if it succeeds.

Description

Sets the target device and line width used for WYSIWYG formatting in a rich edit control.

Remarks

The HDC for the default printer can be obtained as follows.

If lnwidth is zero, no line breaks are created.

Example

DIM hdc AS HDC DIM pd AS PRINTDLGW pd.lStructSize = SIZEOF(pd) pd.flags = PD_RETURNDC OR PD_RETURNDEFAULT IF PrintDlgW(@pd) THEN hdc = = pd.hDC END IF

Reference

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