Thanks to the code that you had posted in the past I have been able to print. In that code you used TextOut, instead I chose to use DrawText, but only 4 and half line of text will print. Do you know why?
Code:
void doPrint(HWND hwnd)
{
PRINTDLG pd;
DOCINFO di = {
sizeof(DOCINFO),
"Fordy's Doc",
NULL
};//This gives details on doc...like its name when spooled
ZeroMemory(&pd,sizeof(PRINTDLG));//saves initiliasing to zero
pd.lStructSize = sizeof(PRINTDLG);
pd.hwndOwner = hwnd;
pd.Flags = PD_RETURNDC;//This gives DC to printer selected
pd.nCopies = 1;
if (PrintDlg(&pd)==TRUE)
{
HWND hEdit = GetDlgItem(hwnd, IDC_MAIN_EDIT);
char buffer[80] = "";
RECT rcClient;
GetClientRect(hEdit, &rcClient);
GetWindowText(hEdit, buffer, 80);
// GDI calls to render output.
if(StartDoc(pd.hDC,&di)>0 && StartPage(pd.hDC)>0){//new doc...new page
DrawText(pd.hDC,buffer, strlen(buffer), &rcClient, DT_WORDBREAK);
EndPage(pd.hDC);//end of page
EndDoc(pd.hDC); //end of doc
}
// Delete DC when done.
DeleteDC(pd.hDC);
}
}