Board index » cppbuilder » Printing a file
mike
![]() CBuilder Developer |
mike
![]() CBuilder Developer |
Printing a file2004-07-21 02:59:10 AM cppbuilder86 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? aloha, mike |
Bob Gonder
![]() CBuilder Developer |
2004-07-21 05:22:56 AM
Re:Printing a file
mike wrote:
QuoteI writing a GUI application and have most of it done. i just need to 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" |