The rich edit control do the printing if you ask it in the OnPrint method:
void CMyView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
ASSERT_VALID(this);
ASSERT_VALID(pDC);
FORMATRANGE fr;
CRect rect;
pDC->SetViewportOrg(-pDC->GetDeviceCaps(PHYSICALOFFSETX),
-pDC->GetDeviceCaps(PHYSICALOFFSETY));
if (::GetDeviceCaps(pDC->m_hDC, TECHNOLOGY) != DT_METAFILE && pDC->m_hAttribDC != NULL)
{
::ScaleWindowExtEx(pDC->m_hDC,
::GetDeviceCaps(pDC->m_hDC, LOGPIXELSX),
::GetDeviceCaps(pDC->m_hAttribDC, LOGPIXELSX),
::GetDeviceCaps(pDC->m_hDC, LOGPIXELSY),
::GetDeviceCaps(pDC->m_hAttribDC, LOGPIXELSY),
NULL);
}
fr.hdcTarget = pDC->m_hAttribDC;
fr.hdc = pDC->m_hDC;
fr.rcPage = GetPageRect();
fr.rc = GetPrintRect();
fr.chrg.cpMin = 0;
fr.chrg.cpMax = fr.chrg.cpMin + GetWindowTextLength();
GetRichEditCtrl().FormatRange(&fr, TRUE);
}
That's only the print method. You should to do some settings in the OnBeginPrinting & OnEndOPrinting if you need change settings before print or clean up after that.