Steve McNeese
April 14th, 1999, 07:43 AM
How can I attach a printer to a CDC object without calling CPrintDialog and the CDC.Attach(GetPrinterDC())? Normally, you would have something like this:
CDC dc;
CPrintDialog printDlg(FALSE);
// ask the user to select a printer
if (printDlg.DoModal() == IDCANCEL)
return;
// Attach a printer DC
dc.Attach(printDlg.GetPrinterDC());
I already know what the printer device name is and I just want to assign that and bypass the dialog asking the user to select the printer. I think I need to eliminate the DoModal() and call printDlg.CreatePrinterDC() but I am not sure how to initialize the DEVMODE and/or DEVNAMES structures and how they are passed or utilized.
Also, how do you change the print margins after you have the printer DC?
Any info would be greatly appreciated.
Thanks,
Steve
Steven M. McNeese
http://steven.mcneese@boeing.com
CDC dc;
CPrintDialog printDlg(FALSE);
// ask the user to select a printer
if (printDlg.DoModal() == IDCANCEL)
return;
// Attach a printer DC
dc.Attach(printDlg.GetPrinterDC());
I already know what the printer device name is and I just want to assign that and bypass the dialog asking the user to select the printer. I think I need to eliminate the DoModal() and call printDlg.CreatePrinterDC() but I am not sure how to initialize the DEVMODE and/or DEVNAMES structures and how they are passed or utilized.
Also, how do you change the print margins after you have the printer DC?
Any info would be greatly appreciated.
Thanks,
Steve
Steven M. McNeese
http://steven.mcneese@boeing.com