Results 1 to 40 of 4199

Thread: CommonControls (Replacement of the MS common controls)

Threaded View

  1. #11

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: CommonControls (Replacement of the MS common controls)

    D'oh, critical bugfix for yesterday update.

    The PrinterDriver/PrinterPort was wrongly extracted from the DEVNAMES structure... (wrong use of the .wOffset members)
    This caused the PrinterDriver/PrinterPort to be cut/truncated. For instance the PrinterDriver 'winspool' got cut/truncated to 'spool'.
    In my testings yesterday this was not shown up as the print dialog however managed to find it.
    But now in a pdf printer I found out that it failed.. (PrinterPort got truncated to null) But with the fix today it is now working.

    Another improvement done as following:
    PrinterDriver/PrinterName/PrinterPort are on default empty. This indicates that the default printer will be initialized.
    However, when a default printer was selected then that default printer got set in the PrinterDriver/PrinterName/PrinterPort.
    When then the user in the meantime changes the system default printer then next time the print dialog shows up the non-default will be selected and not the default.
    The improved solution is now that after user selection the DEVNAMES structure is checked on the wDefault member if it includes the DN_DEFAULTPRN flag.
    If so the PrinterDriver/PrinterName/PrinterPort will be set to empty, if not then they will be set.
    That means that the app should check on return if the PrinterName is empty (= default) or not (= specific) and act accordingly.

    So it could look like this:
    Code:
    Dim ObjPrinter As VB.Printer
    With New CommonDialog
    .PrinterDefault = False
    .Flags = CdlPDUseDevModeCopiesAndCollate
    If .ShowPrinter = True Then
        If .PrinterName = vbNullString Then
            Set ObjPrinter = VB.Printer ' Default
        Else
            For Each ObjPrinter In VB.Printers
                If ObjPrinter.DeviceName = .PrinterName Then Exit For
            Next ObjPrinter
        End If
        MsgBox ObjPrinter.DeviceName
    End If
    End With
    Last edited by Krool; Mar 20th, 2017 at 04:33 PM.

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