PrintDC.c - From User - Antonio

PrintDC.c - From User - Antonio

Postby Davide » Fri Sep 18, 2009 12:51 am

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.aspx
I've solved the problem managing the copies in my prg but perhaphs you may solve it definitely in PrintDC.c

Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: PrintDC.c - From User - Antonio

Postby Antonio Linares » Fri Sep 18, 2009 5:10 pm

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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: PrintDC.c - From User - Antonio

Postby Davide » Fri Sep 18, 2009 5:39 pm

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 view
     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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: PrintDC.c - From User - Antonio

Postby Antonio Linares » Fri Sep 18, 2009 6:05 pm

Davide,

many thanks for your feedback :-)

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

Thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: PrintDC.c - From User - Antonio

Postby Davide » Fri Sep 18, 2009 6:14 pm

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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 67 guests

cron