Benvenuto nelle gioioso mondo della stampa!
Ogni driver assegna ai cassetti delle stampanti che gesctisce valori
diversi. Esistono delle impostazioni standard, quelle che hai usato, ma
generalmente non funzionano su periferiche complesse. Devi andarti a
leggere i valori che il driver assegna ai cassetti.
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
Private Const DC_BINS = 6
Private Const DC_BINNAMES = 12
Sub readBinSETTINGS(Optional devToREAD As String = "")
Dim prn As Printer
Dim dwbins As Long
Dim ct As Long
Dim nameslist As String
Dim nextString As String
Dim numBin() As Integer
Dim A As String, locTXT As String
If devToREAD = "" Then
A = Printer.DeviceName
Else
A = devToREAD
End If
locTXT = ""
For Each prn In Printers
If prn.DeviceName = A Then
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 locTXT <> "" Then locTXT = locTXT & vbCrLf & vbCrLf
locTXT = locTXT & 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
locTXT = locTXT & vbCrLf & nextString
Next ct
End If
Next prn
MsgBox stripMESSAGE(locTXT), vbInformation, "Info cassetti"
End Sub
--
-> G.Chiappori
www.chiappori.it
www.chiappori.com