Showing printer with CommonDialog

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D Wigg

    #1

    Showing printer with CommonDialog

    Hello all,

    I'm using VB6.0 to write an application which prints a report. The problem I
    have occurs when I try to allow the user to select the number of copies and
    which pages to print.

    Using the code below doesn't show the printer box to allow the selections to
    be made but printing happens anyway.

    The PrintRoutine subroutine (not shown) is copied from the MS knowledge base
    allowing printing to a printer or to a print preview form by passing the
    appropriate parameter. (The print preview works fine, but doesn't use a
    CommonDialog call anyway.)
    I don't think the problem lies in the print routine as it isn't called till
    later anyway.

    I use other CommonDialog functions elsewhere in the programme to select
    files from a directory without any problems. Just can't see what I'm doing
    wrong, or not doing at all.

    Suggestions please......

    TIA,
    Dave
    _______________ _______________ _______________ _______________ _______________ _______
    Code snippet follows:

    CommonDialog1.A ction = 5
    CommonDialog1.S howPrinter

    ' Get user selected values

    BeginPage = CommonDialog1.F romPage
    EndPage = CommonDialog1.T oPage
    Numcopies = CommonDialog1.C opies

    ' Code to use start and finish pages and no. of copies to be added later

    PrintRoutine Printer
    Printer.EndDoc



  • Raoul Watson

    #2
    Re: Showing printer with CommonDialog


    "D Wigg" <dnwigg@blueyon der.co.uk> wrote in message
    news:nujOe.1107 1$5m3.470@fe1.n ews.blueyonder. co.uk...[color=blue]
    > Hello all,
    >
    > I'm using VB6.0 to write an application which prints a report. The problem[/color]
    I[color=blue]
    > have occurs when I try to allow the user to select the number of copies[/color]
    and[color=blue]
    > which pages to print.
    >
    > Using the code below doesn't show the printer box to allow the selections[/color]
    to[color=blue]
    > be made but printing happens anyway.
    >
    > The PrintRoutine subroutine (not shown) is copied from the MS knowledge[/color]
    base[color=blue]
    > allowing printing to a printer or to a print preview form by passing the
    > appropriate parameter. (The print preview works fine, but doesn't use a
    > CommonDialog call anyway.)
    > I don't think the problem lies in the print routine as it isn't called[/color]
    till[color=blue]
    > later anyway.
    >
    > I use other CommonDialog functions elsewhere in the programme to select
    > files from a directory without any problems. Just can't see what I'm doing
    > wrong, or not doing at all.
    >
    > Suggestions please......
    >
    > TIA,
    > Dave
    >[/color]
    _______________ _______________ _______________ _______________ _______________ _
    ______[color=blue]
    > Code snippet follows:
    >
    > CommonDialog1.A ction = 5
    > CommonDialog1.S howPrinter
    >
    > ' Get user selected values
    >
    > BeginPage = CommonDialog1.F romPage
    > EndPage = CommonDialog1.T oPage
    > Numcopies = CommonDialog1.C opies
    >
    > ' Code to use start and finish pages and no. of copies to be added later
    >
    > PrintRoutine Printer
    > Printer.EndDoc
    >[/color]

    You may want to try different FLAGS setting priort to calling the printer
    dialog.
    however, the print dialog behavior has lots to do with the way it's handled
    by the printer driver.
    Hundreds of drivers generates hundreds of print dialogs, each with its own
    quircks.
    For example, my code can set the page range on the Epson but on the HP
    Deskjet dialog,
    regardless what flag setting I set, I am unable to ungray the "Pages"
    option.

    May want to try Win API directly.


    Comment

    Working...