Using common dialog box: Print
-
I'm trying to use the Print dialog box in my program. MSDN provides wonderful instruction on how to create the dialog box and display it with certain options, etc., etc., but I can't seem to find from MSDN the code to actually get the ink from the printer to the paper and what to be putting on the paper. I display the dialog, the user can make all kinds of nice selections, but how do I tell it what to print, and how do I make the printer move? Danny
-
I'm trying to use the Print dialog box in my program. MSDN provides wonderful instruction on how to create the dialog box and display it with certain options, etc., etc., but I can't seem to find from MSDN the code to actually get the ink from the printer to the paper and what to be putting on the paper. I display the dialog, the user can make all kinds of nice selections, but how do I tell it what to print, and how do I make the printer move? Danny
Hi, you should use a DC(attach it to your print dialog printer DC), Start a document->start a page-> do whatever you want with the DC(whatever you do will be printed!)->end your page->end your document look below:
CPrintDialog PDlg(FALSE); CDC PDC; /* You don't need this part, since you used the customized dialog if(!PDlg.GetDefaults()) { AfxMessageBox("Error"); return; } */ PDC.Attach(PDlg.GetPrinterDC()); PDC.StartDoc("New Name, will apear in systray"); PDC.StartPage(); PDC.TextOut(0,0,"HELLO!"); PDC.EndPage(); PDC.EndDoc();