BOOL SetTargetDevice( HDC hDC, long lLineWidth );
BOOL SetTargetDevice( CDC& dc, long lLineWidth );
Return Value
Nonzero if successful; otherwise, 0.
Parameters
hDC
Handle to the device context for the new target device.
lLineWidth
Line width to use for formatting.
dc
CDC for the new target device.
Remarks
Call this function to set the target device and line width used for WYSIWYG (what you see is what you get) formatting in this CRichEditCtrl object.
If this function is successful, the rich edit control owns the device context passed as a parameter. In that case, the calling function should not destroy the device context.
For more information, see EM_SETTARGETDEVICE in the Win32 documentation.
Example
// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
// A pointer to a printer DC.
extern CDC* pMyPrinterDC;
// Get line width information from the printer.
long lLineWidth = ::MulDiv(pMyPrinterDC->GetDeviceCaps(PHYSICALWIDTH),
1440, pMyPrinterDC->GetDeviceCaps(LOGPIXELSX));
// Set the printer as the target device.
pmyRichEditCtrl->SetTargetDevice(*pMyPrinterDC, lLineWidth);
CRichEditCtrl Overview | Class Members | Hierarchy Chart
See Also CRichEditCtrl::FormatRange, CRichEditCtrl::DisplayBand