|
-
Sep 3rd, 2010, 05:24 AM
#1
Thread Starter
Addicted Member
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?
Last edited by Hack; Sep 3rd, 2010 at 05:57 AM.
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 3rd, 2010, 06:01 AM
#2
Re: About CommonDialog1.Copies
Try adding cdlPDUseDevModeCopies to the CommonDialog's Flags property.
-
Sep 3rd, 2010, 06:38 AM
#3
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
I did that like this
1. cdPrint.Flags = cdlPDUseDevModeCopies
2. MsgBox cdPrint.Copies
but is not helping either
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 3rd, 2010, 07:12 AM
#4
Re: About CommonDialog1.Copies
According to MSDN
 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
-
Sep 3rd, 2010, 07:37 AM
#5
Re: About CommonDialog1.Copies
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Sep 3rd, 2010, 09:49 AM
#6
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
 Originally Posted by MarMan
Post your code.
is at the first and 3rd post
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 3rd, 2010, 09:50 AM
#7
Re: About CommonDialog1.Copies
There is nothing wrong with the code at the 1st and 3rd. The problem must be elsewhere.
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Sep 3rd, 2010, 10:08 AM
#8
Re: About CommonDialog1.Copies
Are you doing this?
cdPrint.ShowPrinter
-
Sep 3rd, 2010, 11:29 AM
#9
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
 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
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 3rd, 2010, 11:35 AM
#10
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.
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Sep 3rd, 2010, 12:11 PM
#11
Re: About CommonDialog1.Copies
Did you take a look at the Support link I posted?
Have you verified your printer drivers?
-
Sep 6th, 2010, 02:54 AM
#12
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
 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
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 6th, 2010, 03:34 AM
#13
Thread Starter
Addicted Member
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
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 6th, 2010, 09:01 AM
#14
Re: About CommonDialog1.Copies
Can you manually create multiple copies on the Windows 7 PC?
-
Sep 6th, 2010, 10:12 AM
#15
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
 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
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 6th, 2010, 10:31 AM
#16
Re: About CommonDialog1.Copies
 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.
-
Sep 6th, 2010, 10:42 AM
#17
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
 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
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 6th, 2010, 10:44 AM
#18
Re: About CommonDialog1.Copies
 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.
-
Sep 6th, 2010, 11:02 AM
#19
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
 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
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 7th, 2010, 03:29 PM
#20
Re: About CommonDialog1.Copies
Vista? See this link in the FAQ section
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.
-
Sep 7th, 2010, 05:51 PM
#21
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).
-
Sep 7th, 2010, 06:00 PM
#22
Re: About CommonDialog1.Copies
 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?
-
Sep 7th, 2010, 06:12 PM
#23
Re: About CommonDialog1.Copies
 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:
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?
-
Sep 8th, 2010, 05:07 AM
#24
Thread Starter
Addicted Member
Re: About CommonDialog1.Copies
 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
There's only one thing that makes a dream impossible to achieve: THE FEAR OF FAILURE
-
Sep 8th, 2010, 11:26 AM
#25
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|