CRichEditCtrl::SetTargetDevice
Visual Studio 2005
Sets the target device and line width used for WYSIWYG (what you see is what you get) formatting in this CRichEditCtrl object.
BOOL SetTargetDevice( HDC hDC, long lLineWidth ); BOOL SetTargetDevice( CDC& dc, long lLineWidth );
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.
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 Platform SDK.
// 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);