Print copies in VB6 issue

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2008
Posts: 2
Reputation: gedinfo is an unknown quantity at this point 
Solved Threads: 0
gedinfo gedinfo is offline Offline
Newbie Poster

Print copies in VB6 issue

 
0
  #1
Jul 15th, 2008
Hello,

I have inherited an application written in VB6 that does not handle the number of print copies properly. Changing the number of copies to a number other than one(1) results in only (1) print.

I am new at VB6, and would appreciate any tips on how to address this situation.

thank you.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,134
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: Print copies in VB6 issue

 
0
  #2
Jul 15th, 2008
please pass more information .
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2
Reputation: gedinfo is an unknown quantity at this point 
Solved Threads: 0
gedinfo gedinfo is offline Offline
Newbie Poster

Re: Print copies in VB6 issue

 
0
  #3
Jul 15th, 2008
The code appears below, and I understand that txtCopies section is the culprit.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. '/* ------------------------------------------------------------------------- *\
  2. ' m_UPDATEPRINTER()
  3. '
  4. ' Retrieves printer information for the selected printer.
  5. '
  6. '\* ------------------------------------------------------------------------- */
  7.  
  8. Private Sub m_UpdatePrinter()
  9.  
  10. On Error GoTo errHandler
  11.  
  12. Dim mhPrinter As Long
  13. Dim lRet As Long
  14. Dim pDef As PRINTER_DEFAULTS
  15. Dim SizeNeeded As Long
  16. Dim buffer() As Long
  17. Dim Index As Long
  18. Dim lpDevMode As Long
  19.  
  20. lRet = OpenPrinter(Printer.DeviceName, mhPrinter, pDef)
  21.  
  22. Index = 2
  23.  
  24. ReDim Preserve buffer(0 To 1) As Long
  25. lRet = GetPrinterApi(mhPrinter, Index, buffer(0), UBound(buffer), SizeNeeded)
  26. ReDim Preserve buffer(0 To (SizeNeeded / 4) + 3) As Long
  27. lRet = GetPrinterApi(mhPrinter, Index, buffer(0), UBound(buffer) * 4, SizeNeeded)
  28. lRet = ClosePrinter(mhPrinter)
  29.  
  30. With m_PrinterInfo '\\ This variable is of type PRINTER_INFO_2
  31. .pServerName = StringFromPointer(buffer(0), 1024)
  32. .pPrinterName = StringFromPointer(buffer(1), 1024)
  33. .pShareName = StringFromPointer(buffer(2), 1024)
  34. .pPortName = StringFromPointer(buffer(3), 1024)
  35. .pDriverName = StringFromPointer(buffer(4), 1024)
  36. .pComment = StringFromPointer(buffer(5), 1024)
  37. .pLocation = StringFromPointer(buffer(6), 1024)
  38. '.pDevMode = buffer(7)
  39. lpDevMode = buffer(7)
  40. .pSepFile = StringFromPointer(buffer(8), 1024)
  41. .pPrintProcessor = StringFromPointer(buffer(9), 1024)
  42. .pDatatype = StringFromPointer(buffer(10), 1024)
  43. .pParameters = StringFromPointer(buffer(11), 1024)
  44. '.pSecurityDescriptor = buffer(12)
  45. .Attributes = buffer(13)
  46. .priority = buffer(14)
  47. .DefaultPriority = buffer(15)
  48. .StartTime = buffer(16)
  49. .UntilTime = buffer(17)
  50. .Status = buffer(18)
  51. '.JobsCount = buffer(19)
  52. .AveragePPM = buffer(20)
  53.  
  54. CopyMemory .pDevMode, ByVal lpDevMode, Len(.pDevMode)
  55. Printer.ColorMode = .pDevMode.dmColor
  56. Printer.Orientation = .pDevMode.dmOrientation
  57. End With
  58.  
  59. txtCopies.Text = Printer.Copies 'This restricts the print to only 1 page!!!
  60.  
  61. lblStatusValue.caption = m_GetStatusText(m_PrinterInfo.Status)
  62. lblTypeValue.caption = m_PrinterInfo.pDriverName
  63. lblWhereValue.caption = m_PrinterInfo.pPortName
  64. lblCommentValue.caption = m_PrinterInfo.pComment
  65.  
  66. Exit Sub
  67. errHandler:
  68. Call ErrorHandler.HandleError(etALARM, Me.Name, "m_UpdatePrinter")
  69. Resume Next
  70. End Sub
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 36
Reputation: Teropod is an unknown quantity at this point 
Solved Threads: 6
Teropod Teropod is offline Offline
Light Poster

Re: Print copies in VB6 issue

 
0
  #4
Jul 15th, 2008
These is copy paste from help in msdn.

For the Printer object, multiple copies may or may not be collated, depending on the printer driver. Multiple copies of the entire document or multiple copies of each page may be printed. For printers that don't support collating, set Copies = 1, and then use a loop in code to print multiple copies of the entire document.

Note The effect of the properties of the Printer object depends on the driver supplied by the printer manufacturer. Some property settings may have no effect, or several different property settings may all have the same effect. Settings outside the accepted range may produce an error. For more information, see the manufacturer's documentation for the specific driver.

I hope thease will help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC