| | |
Print copies in VB6 issue
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Solved Threads: 0
The code appears below, and I understand that txtCopies section is the culprit.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
'/* ------------------------------------------------------------------------- *\ ' m_UPDATEPRINTER() ' ' Retrieves printer information for the selected printer. ' '\* ------------------------------------------------------------------------- */ Private Sub m_UpdatePrinter() On Error GoTo errHandler Dim mhPrinter As Long Dim lRet As Long Dim pDef As PRINTER_DEFAULTS Dim SizeNeeded As Long Dim buffer() As Long Dim Index As Long Dim lpDevMode As Long lRet = OpenPrinter(Printer.DeviceName, mhPrinter, pDef) Index = 2 ReDim Preserve buffer(0 To 1) As Long lRet = GetPrinterApi(mhPrinter, Index, buffer(0), UBound(buffer), SizeNeeded) ReDim Preserve buffer(0 To (SizeNeeded / 4) + 3) As Long lRet = GetPrinterApi(mhPrinter, Index, buffer(0), UBound(buffer) * 4, SizeNeeded) lRet = ClosePrinter(mhPrinter) With m_PrinterInfo '\\ This variable is of type PRINTER_INFO_2 .pServerName = StringFromPointer(buffer(0), 1024) .pPrinterName = StringFromPointer(buffer(1), 1024) .pShareName = StringFromPointer(buffer(2), 1024) .pPortName = StringFromPointer(buffer(3), 1024) .pDriverName = StringFromPointer(buffer(4), 1024) .pComment = StringFromPointer(buffer(5), 1024) .pLocation = StringFromPointer(buffer(6), 1024) '.pDevMode = buffer(7) lpDevMode = buffer(7) .pSepFile = StringFromPointer(buffer(8), 1024) .pPrintProcessor = StringFromPointer(buffer(9), 1024) .pDatatype = StringFromPointer(buffer(10), 1024) .pParameters = StringFromPointer(buffer(11), 1024) '.pSecurityDescriptor = buffer(12) .Attributes = buffer(13) .priority = buffer(14) .DefaultPriority = buffer(15) .StartTime = buffer(16) .UntilTime = buffer(17) .Status = buffer(18) '.JobsCount = buffer(19) .AveragePPM = buffer(20) CopyMemory .pDevMode, ByVal lpDevMode, Len(.pDevMode) Printer.ColorMode = .pDevMode.dmColor Printer.Orientation = .pDevMode.dmOrientation End With txtCopies.Text = Printer.Copies 'This restricts the print to only 1 page!!! lblStatusValue.caption = m_GetStatusText(m_PrinterInfo.Status) lblTypeValue.caption = m_PrinterInfo.pDriverName lblWhereValue.caption = m_PrinterInfo.pPortName lblCommentValue.caption = m_PrinterInfo.pComment Exit Sub errHandler: Call ErrorHandler.HandleError(etALARM, Me.Name, "m_UpdatePrinter") Resume Next End Sub
•
•
Join Date: Jul 2008
Posts: 36
Reputation:
Solved Threads: 6
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.
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.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Encripted psw check
- Next Thread: identifing patterns in a picture
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






