Registriert seit: 27. Apr 2008
Ort: Rahden
630 Beiträge
|
Re: Drucker mit langen Schachtnamen
3. Feb 2009, 08:57
Vielleicht hilft dir dieser VB-Code ja weiter:
Code:
Option Explicit
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
Const DC_BINS = 6
Const DC_BINNAMES = 12
Private Sub Form_Load()
Dim X%
For X = 0 To Printers.Count - 1
Combo1.AddItem Printers(X).DeviceName
Next X
Combo1.ListIndex = 0
End Sub
Private Sub combo1_Click()
Dim Prn As Printer
If Combo1.ListIndex > -1 Then
For Each Prn In Printers
If Prn.DeviceName = Combo1.List(Combo1.ListIndex) Then
Call GetBins(Prn)
Exit For
End If
Next
End If
End Sub
Private Sub GetBins(Prn As Printer)
Dim X%, p%, AA$, bb$, Bins%, BinList$
Dim PSize$, dX&, dY&
Dim BinNums%()
Bins = DeviceCapabilities(Prn.DeviceName, Prn.Port, _
DC_BINS, ByVal vbNullString, 0)
If Bins Then
ReDim BinNums(1 To Bins)
Bins = DeviceCapabilities(Prn.DeviceName, Prn.Port, _
DC_BINS, BinNums(1), 0)
BinList = String$(24 * Bins, 0)
Bins = DeviceCapabilities(Prn.DeviceName, Prn.Port, _
DC_BINNAMES, ByVal BinList, 0)
List1.Clear
List2.Clear
For X = 1 To Bins
AA = Mid(BinList, 24 * (X - 1) + 1, 24)
p = InStr(AA, vbNullChar)
If p Then AA = Left$(AA, p - 1)
List1.AddItem AA
List2.AddItem BinNums(X)
Next X
End If
End Sub
|
|
Zitat
|