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.

cprintdialog

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 using cprintdialog constructor. once dialog box has been constructed, can set or modify values in m_pd structure initialize values of dialog box's controls. m_pd structure of type printdlg. 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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -