Subj : Re: Printing a file To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Tue Jul 20 2004 03:22 pm mike wrote: >I writing a GUI application and have most of it done. i just need to >integrate the print functionality. i was looking at the help for the win32 >api and it says to use PageSetupDlg () and not PrintDlg (). > >i can get the information, but how do i actually print the data? does anyone >have an example of printing with pure win32 api? I don't use PrintDlg. The following is commented out of my code, so this might not be 100% PrintDlg(&pd); printerDC=pd.hDC /* set up your own font */ oldPrinterFont=setup_font(rows,cols); DOCINFO lpdi = {0}; lpdi.cbSize=sizeof(DOCINFO); lpdi.lpszDocName=ReportLabel; lpdi.lpszOutput=(pd.Flags & PD_PRINTTOFILE) ? "FILE:" : NULL; //NULL for printerDC lpdi.lpszDatatype="RAW"; // Windows 95 only; ignored on Windows NT lpdi.fwType=0; // Banding: Windows 95 only; ignored on Windows NT printerJob=StartDoc(printerDC,&lpdi); if( printerJob<1 ) { /* probably should report the error */ SelectObject(printerDC,oldPrinterFont); //restore original font DeleteObject(printerFont); DeleteDC(printerDC); return FALSE; }; StartPage(printerDC); SetTextAlign(printerDC,TA_LEFT+TA_TOP+TA_NOUPDATECP); SetBkMode (printerDC, TRANSPARENT); return TRUE; See also Google "Groups" search for "bob gonder" "how to print a string" .