-
About CommonDialog1.Copies
I have used the CommonDialog1 to show printer and i used the code below to determine the number of copies to be printed.
1. NumCopies = CommonDialog1.Copies
2. msgbox NumCopies
What i have released is that no matter how i increase the number the NumCopies is still 0.
Can any one help me on how to determine the number of copies to be printed with CommonDialog1.Copies?
any link?
-
Re: About CommonDialog1.Copies
Try adding cdlPDUseDevModeCopies to the CommonDialog's Flags property.
-
Re: About CommonDialog1.Copies
I did that like this
1. cdPrint.Flags = cdlPDUseDevModeCopies
2. MsgBox cdPrint.Copies
but is not helping either
-
Re: About CommonDialog1.Copies
According to MSDN
Quote:
Originally Posted by MSDN
cdlPDUseDevModeCopies - If a printer driver does not support multiple copies, setting this flag disables the Number of Copies spinner control in the Print dialog box. If a driver does support multiple copies, setting this flag indicates that the dialog box stores the requested number of copies in the Copies property.
Here is the link - http://support.microsoft.com/kb/322710
-
Re: About CommonDialog1.Copies
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
MarMan
Post your code.
is at the first and 3rd post
-
Re: About CommonDialog1.Copies
There is nothing wrong with the code at the 1st and 3rd. The problem must be elsewhere.
-
Re: About CommonDialog1.Copies
Are you doing this?
cdPrint.ShowPrinter
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
MarMan
There is nothing wrong with the code at the 1st and 3rd. The problem must be elsewhere.
this is the code
very short n simple but i don't know why is not working
0. cdPrint.Flags = cdlPDUseDevModeCopies
1. cdPrint.ShowPrinter
2. cdPrint.CancelError = True
3. MsgBox cdPrint.Copies
-
Re: About CommonDialog1.Copies
Check to see if you have the correct and latest printer driver. Also set the copies before you show the dialog and report what happens. Try it on another PC and report what happens.
-
Re: About CommonDialog1.Copies
Did you take a look at the Support link I posted?
Have you verified your printer drivers?
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
Hack
Did you take a look at the Support link I posted?
Have you verified your printer drivers?
yeah i did try that but still not helping
Am using VISTA and i dont know if it got to do with it
Please can u try on your pc so i can know if it works?
Thanks a lot
-
Re: About CommonDialog1.Copies
when i tried this link - http://support.microsoft.com/kb/322710 from microsoft on my vista machine, there was no error but still shows only one copy but when i tried it on windows 7 machine it throws arun-time error - 380 (Invalid property value) at this point
1. Printer.Copies = printDlg.Copies
the printDlg.Copies contain the correct number of copies i selected while the printer.copies still have 1
-
Re: About CommonDialog1.Copies
Can you manually create multiple copies on the Windows 7 PC?
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
MartinLiss
Can you manually create multiple copies on the Windows 7 PC?
Manually?
like with MS office?
can't get u well
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
jeffrey4u
Manually?
like with MS office?
can't get u well
Yes, Word or any other program that allows you to print something.
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
MartinLiss
Yes, Word or any other program that allows you to print something.
yes to do print well.
i also tried it with the windows default printer (Microsoft XPS Document Writer) but it didnt work out
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
jeffrey4u
yes to do print well.
i also tried it with the windows default printer (Microsoft XPS Document Writer) but it didnt work out
Then you need to change the printer in the program but I can't help you with that.
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
MartinLiss
Then you need to change the printer in the program but I can't help you with that.
thanks for ur help so far
-
Re: About CommonDialog1.Copies
Vista? See this link in the FAQ section
Quote:
If you need the Printer Setup dialog either using the Common Dialog Control, or by using the API functions, the dialog will not return the correct number of copies. The dialog will always return 1 on Vista. The way around this bug is to create your own Printer Setup dialog box and when you get the correct number of copies you will have to send to the printer multiple times to print out multiple copies. Here is a
link that discusses this issue in details.
-
Re: About CommonDialog1.Copies
I think the FAQ and that linked discussion are both bogus:
Code:
With CommonDialog1
.Flags = cdlPDUseDevModeCopies
.ShowPrinter
MsgBox .Copies
End With
I get the selected number of copies just fine (Vista SP2).
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
dilettante
I think the FAQ and that linked discussion are both bogus.... I get the selected number of copies just fine (Vista SP2).
That's great news I would assume. Though in the linked discussion, some reputable people were stating issues & invalid results. Pre-SP2 problems? Maybe the FAQ should be edited then too?
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
LaVolpe
That's great news I would assume. Though in the linked discussion, some reputable people were stating issues & invalid results. Pre-SP2 problems? Maybe the FAQ should be edited then too?
I suspect they just failed to specify cdlPDUseDevModeCopies, which probably wasn't needed prior to Vista.
If you look at PRINTDLG Structure it's clear the rules changed, though less clear exactly how they've changed. The results I saw didn't seem to match what they say there.
I get the same results using VBPrnDlgLib too for that matter.
One thing that eludes me is that it states:
Quote:
On Windows Vista and Windows 7, when you call PrintDlg or PrintDlgEx with PD_RETURNDC set to TRUE and PD_USEDEVMODECOPIESANDCOLLATE set to FALSE, the PrintDlg or PrintDlgEx function sets the number of copies in the nCopies member of the PRINTDLG structure, and it sets the number of copies in the structure represented by the hDC member of the PRINTDLG structure.
When making calls to GDI, you must ignore the value of nCopies, consider the value as 1, and use the returned hDC to avoid printing duplicate copies.
Yet if I do that I always get 1 back, so I don't need to "consider" it to be 1. Then again I wasn't using GDI to print.
That still bothers me: if I wanted to print via GDI calls is this implying the hDC is holding the Copies setting within the structures "behind" the hDC return value?
-
Re: About CommonDialog1.Copies
Quote:
Originally Posted by
dilettante
I think the FAQ and that linked discussion are both bogus:
Code:
With CommonDialog1
.Flags = cdlPDUseDevModeCopies
.ShowPrinter
MsgBox .Copies
End With
I get the selected number of copies just fine (Vista SP2).
i tried this example on WinXP (Professional version 2002, SP3) and the combo box for No. of copies freezes (like is been locked) so i remarked the first line of code and it worked fine.
With CommonDialog1
'.Flags = cdlPDUseDevModeCopies
.ShowPrinter
MsgBox .Copies
End With
But when i tried it on Windows Vista Home Premium
is still the same old story
-
Re: About CommonDialog1.Copies
I didn't mean to suggest that things haven't changed, but it looks like you can only get the Copies back from the dialog when you use cdlPDUseDevModeCopies and a printer with a driver that supports multiple copies.
It can't be just the CommonDialog control since the PrinterDlg DLL from Microsoft (VBPrnDlg.dll) acts the same way.
This doesn't solve the problem at all. However you can still get Copies for printers that support Copies.
I see very few reports of this problem. Number of copies never passing from print dialog, always 1 is one of them and the "resolution" was the same as we've discussed.
I suspect that in .Net things work the same way.