Page 1 of 1
PrintDC.c - From User - Antonio
Posted: Fri Sep 18, 2009 12:51 am
by Davide
In Windows XP/Vista , sometimes the copies selected by the FROM USER clause don't work.
Please see the Remarks at
http://msdn.microsoft.com/en-us/library ... 85%29.aspxI've solved the problem managing the copies in my prg but perhaphs you may solve it definitely in PrintDC.c
Hi,
Davide
Re: PrintDC.c - From User - Antonio
Posted: Fri Sep 18, 2009 5:10 pm
by Antonio Linares
Davide,
nCopies
Contains the initial number of copies for the Copies edit control if hDevMode is NULL; otherwise, the dmCopies member of the DEVMODE structure contains the initial value. When PrintDlg returns, nCopies contains the actual number of copies to print. This value depends on whether the application or the printer driver is responsible for printing multiple copies. If the PD_USEDEVMODECOPIESANDCOLLATE flag is set in the Flags member, nCopies is always 1 on return, and the printer driver is responsible for printing multiple copies. If the flag is not set, the application is responsible for printing the number of copies specified by nCopies. For more information, see the description of the PD_USEDEVMODECOPIESANDCOLLATE flag.
Do you mean that FWH controls the above automatically ? thanks
Re: PrintDC.c - From User - Antonio
Posted: Fri Sep 18, 2009 5:39 pm
by Davide
Antonio,
Antonio Linares wrote:Do you mean that FWH controls the above automatically ?
1) PRINT oPrn FROM USER
2) The "Choose Printer" dialog box is opened
3) Change the number of copies (in that dialog)
4) Just 1 copy is printed on most cases in Vista
Known issue on Windows XP/Vista/Windows 7: If PD_RETURNDC is set but PD_USEDEVMODECOPIESANDCOLLATE flag is not set, the PrintDlgEx and PrintDlg functions return incorrect number of copies. To get the correct number of copies, ensure that the calling application always uses PD_USEDEVMODECOPIESANDCOLLATE with PD_RETURNDC.
In PrintDc.c I see only references to PD_USEDEVMODECOPIES
Code: Select all | Expand
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIES |
PD_HIDEPRINTTOFILE | PD_NOSELECTION ;
Perhaps those flags should use PD_USEDEVMODECOPIESANDCOLLATE nowadays, and that would fix the problem (but I didn't try it)
Hi,
Davide
Re: PrintDC.c - From User - Antonio
Posted: Fri Sep 18, 2009 6:05 pm
by Antonio Linares
Davide,
many thanks for your feedback

If you are so kind to test your own proposal, it would be great

Thanks,
Re: PrintDC.c - From User - Antonio
Posted: Fri Sep 18, 2009 6:14 pm
by Davide
Antonio,
Antonio Linares wrote:If you are so kind to test your own proposal, it would be great
I'm not sure if I should change EVERY pd.flags line or only some of them. I though that you may have done a better job, as you know better than me the logic behind Printdc.c
If you can replicate the problem at your location, I'm pretty
confident you can test that change within minutes, otherwise I'll try to do it here as soon as I can replicate it (I applied the fix in the prg long ago. This thread is just because I've seen that remark while searching for other things, and though it might have been useful for others)
Hi,
Davide