windows - How to change customized CPrintDialog's properties -
i want change cprintdialog's properties when printer change app.
i have set printer name in oninitdialog() of custom cprintdialog.
ccombobox *wndcmbbox = (ccombobox *)getdlgitem( idc_per_user ); if( wndcmbbox != null ) { wndcmbbox->selectstring( -1, s_printername); }
the problem that, printer name can set in combo box property not set. mean printer status, type, etc... default, default printer's property set. so, conflict.
but, if changed printer combobox of cprintdialog automatically property changed per printer selection.
i dint find solution yet anywhere. please refer image have attached.
edit cody suggest, can changed printer per selected printer app, if apply print command, print goes selected printer, gone well, not issue, issue is, on first time of open print dialog, properties not match selected printer, if printer selected other default printer app.
you doing wrong. should not customize printing settings displaying printer dialog , programmatically manipulating controls. that's bound go wrong, you've observed does. not expected use model common dialog.
instead, set default values cprintdialog
modifying m_pd
structure, described in the documentation:
to use
cprintdialog
object, first create object usingcprintdialog
constructor. once dialog box has been constructed, can set or modify values inm_pd
structure initialize values of dialog box's controls.m_pd
structure of typeprintdlg
. more information on structure, see windows sdk.
you can programmatically change default printer entire application. doesn't require showing dialogs @ all. this, call selectprinter
function. sets new printer , releases previously-selected printer.
once you've done this, time print dialog displayed, automatically show specified printer selected. , when retrieve information selected printer, information retrieve apply correct printer.
find more information in msdn article: how programmatically print non-default printer in mfc
Comments
Post a Comment