Get the default printer
-
Hi all, When I print a document, I use the CPrinterDialog class. This works fine when I want to show the user the dialog and then het the printer's device context using "GetPrinterDC ()". But when the user clicks the print icon on the toolbar, I want to print without asking for the relevant printer, i.e. using the default printer. However, when I call "CPrintDialog::CreatePrinterDC ()", I do not get a DC. Microsoft's doc says that you then still need to initialise the dialog by DoModal, but I do not want that, since I do not want to show the user this dialog. Any bright ideas on how to get the default printer directly? Thanks in advance William
-
Hi all, When I print a document, I use the CPrinterDialog class. This works fine when I want to show the user the dialog and then het the printer's device context using "GetPrinterDC ()". But when the user clicks the print icon on the toolbar, I want to print without asking for the relevant printer, i.e. using the default printer. However, when I call "CPrintDialog::CreatePrinterDC ()", I do not get a DC. Microsoft's doc says that you then still need to initialise the dialog by DoModal, but I do not want that, since I do not want to show the user this dialog. Any bright ideas on how to get the default printer directly? Thanks in advance William
Found the solution meanwhile (in case anybody is interested) call the printDialog's "GetDefaults ()" function will do the job. If there is no default printer, the function will return FALSE, in which case a print dialog should be shown anyway. Regards, WIlliam
-
Hi all, When I print a document, I use the CPrinterDialog class. This works fine when I want to show the user the dialog and then het the printer's device context using "GetPrinterDC ()". But when the user clicks the print icon on the toolbar, I want to print without asking for the relevant printer, i.e. using the default printer. However, when I call "CPrintDialog::CreatePrinterDC ()", I do not get a DC. Microsoft's doc says that you then still need to initialise the dialog by DoModal, but I do not want that, since I do not want to show the user this dialog. Any bright ideas on how to get the default printer directly? Thanks in advance William
Is
GetDefaultPrinter
good?_**
**_
WhiteSky