Results 1 to 25 of 25

Thread: Problem with Printing in Vista

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Arrow Problem with Printing in Vista

    Hello.
    We have a problem with printing in Vista.
    Using for example:
    numcopies = commondialog1.copies
    or
    numcopies = printer.copies
    is generating "1"
    No matter what the user input was.
    So even if you want to print 4 copies, it will only print one.
    Works obvious perfectly on XP.
    Anyone with a solution?
    Thanks in advance

  2. #2
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Problem with Printing in Vista

    Shouldn't your command be?

    Code:
    Printer.Copies = CommonDialog1.Copies

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    Well.
    It doesn't matter. You ca use both.
    In any case the value returned will be "1", no matter the user input.
    So when using
    Printer.Copies = CommonDialog1.Copies
    And the user chooses 4 copies, it will still only return "1".
    I'm quite certain it is a bug in Vista.
    Anyone know how to work around it?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    Looks like its a VB 6 bug and not a Vista bug per se.

    I tested it on Vista and VB 6 and same issue as you. Then again I tested it on Vista and VB.NET 2005 and it works correctly.

    I would think its part of the bugs why VB 6 is unsupported on Vista.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    According to Microsoft http://msdn2.microsoft.com/en-us/vbrun/ms788708.aspx it shouldn't be that way. It should work the same way on Vista as on Xp. But it doesn't.
    Anyone that knows a way to work around it?
    Thankful if anyone knows!

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    No, I read it the other way around.

    Tested and Not Shipping In Windows Vista
    '...
    comdlg32.ocx
    '...
    So they only tested it and are not including it in shipments because its not up to compatibility standards.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    More precisly:
    For Windows Vista, key Visual Basic 6.0 runtime files are shipping as a part of the operating system and will be supported for the lifetime of Windows Vista.

    '....

    Binaries that do not ship on Windows Vista will follow their planned support lifetime. These files are being tested for compatibility as part of our testing of Visual Basic 6.0 applications running on Windows Vista, but they will need to be deployed by the application setup and will not be supported as part of Windows Vista. The list of runtime files distributed with Vista can be found below.
    So you see, its not supported but is tested on.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    Hello. Microsoft writes:
    The Visual Basic team is committed to “It Just Works” compatibility for Visual Basic 6.0 applications on Windows® Vista™. The Visual Basic team’s goal is that Visual Basic 6.0 applications that run on Windows XP will also run on Windows Vista.
    BUT
    That is NOT my point.
    Obviouslly it is not working.
    BUT anyone knows how to solve it.
    That menas. Print more then one copies using Vista ?
    There are still a huge amount of software programmed in VB6.
    There got to be a solution.
    Anyone knows?

  9. #9
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Problem with Printing in Vista

    Does your printer support Multiple copies?

    Another fix could be to generate the copies by sending the report pages to the selected device 4 times?

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    But thats not relevant. Reading the commondialog .Copies property always returns "1" even when you select "2" or "99". If you can not read what the user has selected in the dialog box then its useless in trying to know how many copies to print.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    But is there a way around this?
    Something else to use instead of Commondialogbox ?

  12. #12
    New Member
    Join Date
    Feb 2007
    Posts
    3

    Re: Problem with Printing in Vista

    It may always read 1, however if that is true, than you can control the amount of loops that will be created. You asked for a work around, that sounds like one to me. I'm sure we'll see quite a few "fixes" for vb6 on Vista, but thats just my opinion.

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    Sure, create your own form duplicaating the features you need. The Printer object still seems to work fine.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Problem with Printing in Vista

    Does it always return 1 using the Printer API dialog?

    Code:
    Public Function ShowPrinter(frmOwner As Form, Optional PrintFlags As Long) As Boolean
    
    Dim PrintDlg As PRINTDLG_TYPE
    Dim DevMode As DEVMODE_TYPE
    Dim DevName As DEVNAMES_TYPE
    
    Dim lpDevMode As Long
    Dim lpDevName As Long
    'Dim bReturn As Integer
    Dim objPrinter As Printer
    Dim NewPrinterName As String
    
    ' Use PrintDialog to get the handle to a memory
    ' block with a DevMode and DevName structures
    
    ShowPrinter = True
    
    PrintDlg.lStructSize = Len(PrintDlg)
    PrintDlg.hwndOwner = frmOwner.hWnd
    
    PrintDlg.flags = PrintFlags
    
    On Error Resume Next
    'Set the current orientation and duplex setting
    DevMode.dmDeviceName = Printer.DeviceName
    DevMode.dmSize = Len(DevMode)
    DevMode.dmFields = DM_ORIENTATION Or DM_DUPLEX
    DevMode.dmPaperWidth = Printer.Width
    DevMode.dmOrientation = Printer.Orientation
    DevMode.dmPaperSize = Printer.PaperSize
    DevMode.dmDuplex = Printer.Duplex
    
    On Error GoTo ErrorHandler
    
    'Allocate memory for the initialization hDevMode structure
    'and copy the settings gathered above into this memory
    PrintDlg.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DevMode))
    lpDevMode = GlobalLock(PrintDlg.hDevMode)
    
    If lpDevMode > 0 Then
        CopyMemory ByVal lpDevMode, DevMode, Len(DevMode)
        'bReturn = GlobalUnlock(PrintDlg.hDevMode)
        Call GlobalUnlock(PrintDlg.hDevMode)
    End If
    
    'Set the current driver, device, and port name strings
    With DevName
        .wDriverOffset = 8
        .wDeviceOffset = .wDriverOffset + 1 + Len(Printer.DriverName)
        .wOutputOffset = .wDeviceOffset + 1 + Len(Printer.Port)
        .wDefault = 0
    End With
    
    With Printer
        DevName.extra = .DriverName & vbNullChar & .DeviceName & vbNullChar & .Port & vbNullChar
    End With
    
    'Allocate memory for the initial hDevName structure
    'and copy the settings gathered above into this memory
    PrintDlg.hDevNames = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DevName))
    lpDevName = GlobalLock(PrintDlg.hDevNames)
    
    If lpDevName > 0 Then
        CopyMemory ByVal lpDevName, DevName, Len(DevName)
        'bReturn = GlobalUnlock(lpDevName)
        Call GlobalUnlock(lpDevName)
    End If
    
    If PrintDialog(PrintDlg) <> 0 Then
        ShowPrinter = True
        lpDevName = GlobalLock(PrintDlg.hDevNames)
        CopyMemory DevName, ByVal lpDevName, 45
        'bReturn = GlobalUnlock(lpDevName)
        Call GlobalUnlock(lpDevName)
        GlobalFree PrintDlg.hDevNames
        
        'Next get the DevMode structure and set the printer
        'properties appropriately
        lpDevMode = GlobalLock(PrintDlg.hDevMode)
        CopyMemory DevMode, ByVal lpDevMode, Len(DevMode)
        'bReturn = GlobalUnlock(PrintDlg.hDevMode)
        Call GlobalUnlock(PrintDlg.hDevMode)
        GlobalFree PrintDlg.hDevMode
        NewPrinterName = UCase$(Left(DevMode.dmDeviceName, InStr(DevMode.dmDeviceName, vbNullChar) - 1))
        
        If Printer.DeviceName <> NewPrinterName Then
            For Each objPrinter In Printers
                If UCase$(objPrinter.DeviceName) = NewPrinterName Then
                    Set Printer = objPrinter
                End If
            Next objPrinter
        End If
    
        On Error Resume Next
        Printer.Copies = DevMode.dmCopies
        Printer.Duplex = DevMode.dmDuplex
        Printer.Orientation = DevMode.dmOrientation
        Printer.PaperSize = DevMode.dmPaperSize
        Printer.PrintQuality = DevMode.dmPrintQuality
        Printer.ColorMode = DevMode.dmColor
        Printer.PaperBin = DevMode.dmDefaultSource
    Else
        ShowPrinter = False
    End If
    
    Exit Function
    ErrorHandler:
    ShowPrinter = True
    
    End Function
    Code:
    If ShowPrinter(Me, cdlPDNoSelection Or cdlPDNoPageNums Or cdlPDNoWarning Or cdlPDUseDevModeCopies Or cdlPDHidePrintToFile) Then
         Printer.Print "Test"
         Printer.EndDoc
    End If
    If that still doesn't work you could always make a custom Print Dialog. Here is an example:
    http://www.freevbcode.com/ShowCode.asp?ID=3847
    Last edited by Hassan Basri; Mar 11th, 2007 at 01:03 PM.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    Thats the code from allapi.mentalis.org? ...

    Complete example trimmed down for just the print dialog

    vb Code:
    1. Option Explicit
    2.  
    3. Const CCHDEVICENAME = 32
    4. Const CCHFORMNAME = 32
    5. Const GMEM_MOVEABLE = &H2
    6. Const GMEM_ZEROINIT = &H40
    7. Const DM_DUPLEX = &H1000&
    8. Const DM_ORIENTATION = &H1&
    9. Const PD_PRINTSETUP = &H40
    10. Const PD_DISABLEPRINTTOFILE = &H80000
    11.  
    12. Private Type PRINTDLG_TYPE
    13.     lStructSize As Long
    14.     hwndOwner As Long
    15.     hDevMode As Long
    16.     hDevNames As Long
    17.     hDC As Long
    18.     flags As Long
    19.     nFromPage As Integer
    20.     nToPage As Integer
    21.     nMinPage As Integer
    22.     nMaxPage As Integer
    23.     nCopies As Integer
    24.     hInstance As Long
    25.     lCustData As Long
    26.     lpfnPrintHook As Long
    27.     lpfnSetupHook As Long
    28.     lpPrintTemplateName As String
    29.     lpSetupTemplateName As String
    30.     hPrintTemplate As Long
    31.     hSetupTemplate As Long
    32. End Type
    33.  
    34. Private Type DEVNAMES_TYPE
    35.     wDriverOffset As Integer
    36.     wDeviceOffset As Integer
    37.     wOutputOffset As Integer
    38.     wDefault As Integer
    39.     extra As String * 100
    40. End Type
    41.  
    42. Private Type DEVMODE_TYPE
    43.     dmDeviceName As String * CCHDEVICENAME
    44.     dmSpecVersion As Integer
    45.     dmDriverVersion As Integer
    46.     dmSize As Integer
    47.     dmDriverExtra As Integer
    48.     dmFields As Long
    49.     dmOrientation As Integer
    50.     dmPaperSize As Integer
    51.     dmPaperLength As Integer
    52.     dmPaperWidth As Integer
    53.     dmScale As Integer
    54.     dmCopies As Integer
    55.     dmDefaultSource As Integer
    56.     dmPrintQuality As Integer
    57.     dmColor As Integer
    58.     dmDuplex As Integer
    59.     dmYResolution As Integer
    60.     dmTTOption As Integer
    61.     dmCollate As Integer
    62.     dmFormName As String * CCHFORMNAME
    63.     dmUnusedPadding As Integer
    64.     dmBitsPerPel As Integer
    65.     dmPelsWidth As Long
    66.     dmPelsHeight As Long
    67.     dmDisplayFlags As Long
    68.     dmDisplayFrequency As Long
    69. End Type
    70.  
    71. Private Declare Function PrintDialog Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG_TYPE) As Long
    72. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
    73. Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
    74. Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long
    75. Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
    76. Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
    77.  
    78. Private Sub Command1_Click()
    79.     ShowPrinter Me
    80. End Sub
    81.  
    82. Private Sub Form_Load()
    83.     Command1.Caption = "ShowPrinter"
    84. End Sub
    85.  
    86. Public Sub ShowPrinter(frmOwner As Form, Optional PrintFlags As Long)
    87.     '-> Code by Donald Grover
    88.     Dim PrintDlg As PRINTDLG_TYPE
    89.     Dim DevMode As DEVMODE_TYPE
    90.     Dim DevName As DEVNAMES_TYPE
    91.  
    92.     Dim lpDevMode As Long, lpDevName As Long
    93.     Dim bReturn As Integer
    94.     Dim objPrinter As Printer, NewPrinterName As String
    95.  
    96.     ' Use PrintDialog to get the handle to a memory
    97.     ' block with a DevMode and DevName structures
    98.     PrintDlg.lStructSize = Len(PrintDlg)
    99.     PrintDlg.hwndOwner = frmOwner.hWnd
    100.  
    101.     PrintDlg.flags = PrintFlags
    102.     On Error Resume Next
    103.     'Set the current orientation and duplex setting
    104.     DevMode.dmDeviceName = Printer.DeviceName
    105.     DevMode.dmSize = Len(DevMode)
    106.     DevMode.dmFields = DM_ORIENTATION Or DM_DUPLEX
    107.     DevMode.dmPaperWidth = Printer.Width
    108.     DevMode.dmOrientation = Printer.Orientation
    109.     DevMode.dmPaperSize = Printer.PaperSize
    110.     DevMode.dmDuplex = Printer.Duplex
    111.     On Error GoTo 0
    112.  
    113.     'Allocate memory for the initialization hDevMode structure
    114.     'and copy the settings gathered above into this memory
    115.     PrintDlg.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DevMode))
    116.     lpDevMode = GlobalLock(PrintDlg.hDevMode)
    117.     If lpDevMode > 0 Then
    118.         CopyMemory ByVal lpDevMode, DevMode, Len(DevMode)
    119.         bReturn = GlobalUnlock(PrintDlg.hDevMode)
    120.     End If
    121.  
    122.     'Set the current driver, device, and port name strings
    123.     With DevName
    124.         .wDriverOffset = 8
    125.         .wDeviceOffset = .wDriverOffset + 1 + Len(Printer.DriverName)
    126.         .wOutputOffset = .wDeviceOffset + 1 + Len(Printer.Port)
    127.         .wDefault = 0
    128.     End With
    129.  
    130.     With Printer
    131.         DevName.extra = .DriverName & Chr(0) & .DeviceName & Chr(0) & .Port & Chr(0)
    132.     End With
    133.  
    134.     'Allocate memory for the initial hDevName structure
    135.     'and copy the settings gathered above into this memory
    136.     PrintDlg.hDevNames = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DevName))
    137.     lpDevName = GlobalLock(PrintDlg.hDevNames)
    138.     If lpDevName > 0 Then
    139.         CopyMemory ByVal lpDevName, DevName, Len(DevName)
    140.         bReturn = GlobalUnlock(lpDevName)
    141.     End If
    142.  
    143.     'Call the print dialog up and let the user make changes
    144.     If PrintDialog(PrintDlg) <> 0 Then
    145.  
    146.         'First get the DevName structure.
    147.         lpDevName = GlobalLock(PrintDlg.hDevNames)
    148.         CopyMemory DevName, ByVal lpDevName, 45
    149.         bReturn = GlobalUnlock(lpDevName)
    150.         GlobalFree PrintDlg.hDevNames
    151.  
    152.         'Next get the DevMode structure and set the printer
    153.         'properties appropriately
    154.         lpDevMode = GlobalLock(PrintDlg.hDevMode)
    155.         CopyMemory DevMode, ByVal lpDevMode, Len(DevMode)
    156.         bReturn = GlobalUnlock(PrintDlg.hDevMode)
    157.         GlobalFree PrintDlg.hDevMode
    158.         NewPrinterName = UCase$(Left(DevMode.dmDeviceName, InStr(DevMode.dmDeviceName, Chr$(0)) - 1))
    159.         If Printer.DeviceName <> NewPrinterName Then
    160.             For Each objPrinter In Printers
    161.                 If UCase$(objPrinter.DeviceName) = NewPrinterName Then
    162.                     Set Printer = objPrinter
    163.                     'set printer toolbar name at this point
    164.                 End If
    165.             Next
    166.         End If
    167.  
    168.         On Error Resume Next
    169.         'Set printer object properties according to selections made
    170.         'by user
    171.         Printer.Copies = DevMode.dmCopies
    172.         Printer.Duplex = DevMode.dmDuplex
    173.         Printer.Orientation = DevMode.dmOrientation
    174.         Printer.PaperSize = DevMode.dmPaperSize
    175.         Printer.PrintQuality = DevMode.dmPrintQuality
    176.         Printer.ColorMode = DevMode.dmColor
    177.         Printer.PaperBin = DevMode.dmDefaultSource
    178.         On Error GoTo 0
    179.         MsgBox Printer.Copies
    180.     End If
    181. End Sub
    I added the msgbox at the end to display the copies property and it still doesnt return anything other then "1".

    So even with my previous suggestion to create your own you will have to loop to print out multiple copies.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    To loop is not a problem.
    But it has to be userfriendly.
    Any suggestions?

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    When you create your own dialog mimic the layout of the default built in one so the users wont be too confused.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    Hello again.
    Just to clarify.
    Yes, it still only returns 1. No matter the input.
    Tried the code from FreevbCode.com, and it is a lot of code, and I have not even been able to get it to work.
    What is needed is a fix that is as easy as possible for the user.
    So the user can choose 2,3 or 4 or whatever he wants, and it is returned.
    Anyone that knows?

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    Like I already suggested, you need to create your own dialog. This is the only known way to work around the issue until its fixed by MS (if ever).
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    As Vb 6 is one of the most commonly used programming languages there are, I am certain there hava to be a better solution then creating your own dialog.
    Someone how knows?

  21. #21
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    Without being able to fix the bug in Ms' control it makes it difficult to say the least.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  22. #22
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: Problem with Printing in Vista

    RobDog, here is the code I've been using for Copy looping:
    Code:
    CommonDialog1.Flags = &H100000 Or &H4&
    CommonDialog1.ShowPrinter
    NumCopies = CommonDialog1.Copies
    For I=1 TO NumCopies
        'Print Something
    Next
    I believe what you are saying is that Vista ignores whatever the command dialog box returns and sets it to 1.

    What about allowing the user to set the number of copies before the Command Dialog box appears? Then, suppress the option to change the number of copies. Is that feasible?
    Doctor Ed

  23. #23
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    Yes, that is feasible and something along the lines of what I have suggested several times in this thread but no one listens. The cdl .Copies property does not work at all in Vista. So either you manually create your own dialog or you code in the copies from some other control or just hard code it depending on your needs.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  24. #24

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Re: Problem with Printing in Vista

    Well.
    As the one that started this thread lets try to get this right.
    That you can work around it by a selfcreated loop is obvious for everyone. I have of course known that all the time, and would not have asked the question because of that.
    You can create a textbox, let the user tell how many copies he wants, and then use that input to decide how many copies to print.
    That is quite obvious, but was by no means the reason I asked the question.

    I LOOK FOR A SENSIBLE SOLUTION!
    A real solution!
    The ones suggested here don't sound like that at all. Sounds like a homemaid solution, not a proffessional one.

    So if you don't know a solution, that's fine, please then don't answer. And from the ones that have answered until now, it is obvious that no one knows.

    BUT IF YOU KNOW PLEASE LET ME KNOW.

    Microsoft tells the following:
    The Visual Basic team is committed to “It Just Works” compatibility for Visual Basic 6.0 applications on Windows® Vista™. The Visual Basic team’s goal is that Visual Basic 6.0 applications that run on Windows XP will also run on Windows Vista.
    So it should work, but it doesn't.

    As said, there is no point using time, with a discusion like the one above.
    But if you know a real and proffessional solution, please tell!

  25. #25
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Problem with Printing in Vista

    We do know. Its not supported under Vista as shown by the link where its listed under the "Tested but not shipping" section as it still needs a fix which MS has not yet done. If you dont want to believe those of us that have tested and explained this to you then perhaps you should call Microsoft and create a support incident as you obviously do not believe me or others.

    Just because you look for a solution does not mean that there is one. Even the one where you would have to create your own print dialog window/form would be the best professional solution but still its not acceptable to you. Sorry but I'm not wasting anymore time on this thread.

    Later
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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