Results 1 to 25 of 25

Thread: About CommonDialog1.Copies

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: About CommonDialog1.Copies

    Try adding cdlPDUseDevModeCopies to the CommonDialog's Flags property.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    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

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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

  5. #5
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: About CommonDialog1.Copies

    Post your code.
    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

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    Re: About CommonDialog1.Copies

    Quote Originally Posted by MarMan View Post
    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

  7. #7
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    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

  8. #8

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    Re: About CommonDialog1.Copies

    Quote Originally Posted by MarMan View Post
    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

  10. #10
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    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

  11. #11
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: About CommonDialog1.Copies

    Did you take a look at the Support link I posted?

    Have you verified your printer drivers?

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    Re: About CommonDialog1.Copies

    Quote Originally Posted by Hack View Post
    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

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    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

  14. #14

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    Re: About CommonDialog1.Copies

    Quote Originally Posted by MartinLiss View Post
    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

  16. #16

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    Re: About CommonDialog1.Copies

    Quote Originally Posted by MartinLiss View Post
    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

  18. #18
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: About CommonDialog1.Copies

    Quote Originally Posted by jeffrey4u View Post
    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.

  19. #19

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    Re: About CommonDialog1.Copies

    Quote Originally Posted by MartinLiss View Post
    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

  20. #20
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  21. #21
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    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).

  22. #22
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: About CommonDialog1.Copies

    Quote Originally Posted by dilettante View Post
    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?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  23. #23
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: About CommonDialog1.Copies

    Quote Originally Posted by LaVolpe View Post
    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?

  24. #24

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    Obuasi
    Posts
    151

    Re: About CommonDialog1.Copies

    Quote Originally Posted by dilettante View Post
    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

  25. #25
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    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
  •  



Click Here to Expand Forum to Full Width