Help Center

CRichEditCtx.SetTargetDevicemethod

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

Windowsmethoddocumented

Syntax

FUNCTION SetTargetDevice (BYVAL hDC AS HDC, BYVAL lnwidth AS LONG) AS BOOLEAN

Parameters

NameDescription
hDCHDC [Handle to a Device Context] for the target device.
lnwidthLine width to use for formatting.

Return value

If the method succeeds it returns the boolean value true (-1); if it fails, it returns false (0).

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/CRichEditCtx.inc:3019
  • Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
  • Topic: CRichEditCtx Class