Results 1 to 2 of 2

Thread: Problem calling paper.bin on printer

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    1
    The printer I have to use have 4 paper bin and I have to use the second and fourth paper bin. VB is managing only upper, lower and middle paper bin. I was told that I have to use API and call the proper Function. I am not an expert and I would really like if somebody could help me on this one.

    [email protected]
    Sylvain Menard

  2. #2
    Member
    Join Date
    Aug 2000
    Posts
    60

    Cool

    The only bins windows will pick up are:

    DMBIN_ONLYONE
    DMBIN_LOWER
    DMBIN_MIDDLE
    DMBIN_MANUAL
    DMBIN_ENVELOPE
    DMBIN_ENVMANUAL
    DMBIN_AUTO
    DMBIN_TRACTOR
    DMBIN_SMALLFMT
    DMBIN_LARGEFMT
    DMBIN_LARGECAPACITY
    DMBIN_CASSETTE
    DMBIN_FORMSOURCE

    you can tell which ones of these are available by doing the following:

    1. Create a Standard EXE project in Visual Basic. Form1 is created by default.


    2. Add a CommandButton and TextBox to the form.


    3. Set Text1's ScrollBar property to "2 - Vertical" and the MultiLine property to "True."


    4. Place the following code into Form1's code window:



    Private Declare Function DeviceCapabilities Lib "winspool.drv" _
    Alias "DeviceCapabilitiesA" (ByVal lpDeviceName As String, _
    ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, _
    ByVal dev As Long) As Long

    Private Const DC_BINS = 6
    Private Const DC_BINNAMES = 12

    Private Sub Command1_Click()
    Dim prn As Printer
    Dim dwbins As Long
    Dim ct As Long
    Dim nameslist As String
    Dim nextString As String
    Dim numBin() As Integer

    Text1.Font.Name = "Courier New"
    Text1.Font.Size = 12
    Text1.Text = ""
    For Each prn In Printers
    dwbins = DeviceCapabilities(prn.DeviceName, prn.Port, _
    DC_BINS, ByVal vbNullString, 0)
    ReDim numBin(1 To dwbins)
    nameslist = String(24 * dwbins, 0)
    dwbins = DeviceCapabilities(prn.DeviceName, prn.Port, _
    DC_BINS, numBin(1), 0)
    dwbins = DeviceCapabilities(prn.DeviceName, prn.Port, _
    DC_BINNAMES, ByVal nameslist, 0)
    If Text1.Text <> "" Then
    Text1.Text = Text1.Text & vbCrLf & vbCrLf
    End If
    Text1.Text = Text1.Text & prn.DeviceName
    For ct = 1 To dwbins
    nextString = Mid(nameslist, 24 * (ct - 1) + 1, 24)
    nextString = Left(nextString, InStr(1, nextString, _
    Chr(0)) - 1)
    nextString = String(6 - Len(CStr(numBin(ct))), " ") & _
    numBin(ct) & " " & nextString
    Text1.Text = Text1.Text & vbCrLf & nextString
    Next ct
    Next prn
    End Sub

    Private Sub Form_Load()
    ' Size and position the Form and controls
    Me.Height = 7000
    Me.Width = 7000
    Text1.Top = 100
    Text1.Left = 100
    Text1.Height = 6450
    Text1.Width = 5000
    Text1.Text = "" ' Clear the TextBox
    Command1.Left = 5300
    Command1.Top = 1000
    Command1.Width = 1500
    Command1.Caption = "List Bins"
    End Sub




    5. Run the project and click on the CommandButton labeled "List Bins." The TextBox is filled with a list of all installed printers and the PaperBin settings each one supports.


    Hope this is of some assistance

    Grant French
    E-Mail: [email protected]
    ICQ: 33122184

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