![]() |
Druckerschaechte
Hey Leute ich habe eine kleine Anwendung geschrieben.
Diese ermittelt die installierten Drucker und Schächte. Nun möchte ich auch noch das dieser die Schachtnummern anzeigt. Habt ihr einen Ansatz. Hier ist schon mal mein Ansatz.
Delphi-Quellcode:
procedure GetPaperBins(sl: TStrings);
type TBinName = array [0..23] of Char; TBinNameArray = array [1..High(Integer) div SizeOf(TBinName)] of TBinName; PBinnameArray = ^TBinNameArray; TBinArray = array [1..High(Integer) div SizeOf(Word)] of Word; PBinArray = ^TBinArray; var Device, Driver, Port: array [0..255] of Char; hDevMode: THandle; i, numBinNames, numBins, temp: Integer; pBinNames: PBinnameArray; pBins: PBinArray; begin Printer.PrinterIndex := -1; Printer.GetPrinter(Device, Driver, Port, hDevmode); numBinNames := WinSpool.DeviceCapabilities(Device, Port, DC_BINNAMES, nil, nil); numBins := WinSpool.DeviceCapabilities(Device, Port, DC_BINS, nil, nil); if numBins <> numBinNames then begin raise Exception.Create('DeviceCapabilities reports different number of bins and bin names!'); end; if numBinNames > 0 then begin pBins := nil; GetMem(pBinNames, numBinNames * SizeOf(TBinname)); GetMem(pBins, numBins * SizeOf(Word)); try WinSpool.DeviceCapabilities(Device, Port, DC_BINNAMES, PChar(pBinNames), nil); WinSpool.DeviceCapabilities(Device, Port, DC_BINS, PChar(pBins), nil); sl.Clear; for i := 1 to numBinNames do begin temp := pBins^[i]; sl.addObject(pBinNames^[i], TObject(temp)); end; finally FreeMem(pBinNames); if pBins <> nil then FreeMem(pBins); end; end; end; Vielen Dank |
AW: Druckerschaechte
Hallo Paschi,
welche Schachtnummer meinst Du ? Die physische Schachtnummer oder so wie der Schacht über den Treiber anzusteuern ist ? Die physischen Schächte kannst Du über meine Komponente ![]() |
AW: Druckerschaechte
Zitat:
meinst du etwa so: Paper Bins : Automatischer Einzug = 7 Mehrzweckfach (MZ) = 1 Kassette = 2 Manuelle Papierzufuhr = 4 Untere Kassette = 11 Umschlag-Zuführung = 5 Das macht bei mir ein uraltes (voriges Jahrtausend) Programm so:
Delphi-Quellcode:
Gruss Reinhard
type
TDeviceCapabilitiesP = function(DeviceName, Port: PChar; Index: Word; Output: PChar; pDM : PDevMode): Longint; {...} var TestDC : HDC; DCfunction : TDeviceCapabilitiesP; {...} { Zufuhr } procedure put_bins; const dc_Binnames = 12; type TBinName = array [0..23] of char; Tbnarray = array [0..99] of TBinName; Pbnarray = ^Tbnarray; Tbvarray = array [0..99] of word; Pbvarray = ^Tbvarray; var bnames : Tbnarray; bvalues : Tbvarray; bnptr : Pbnarray; bvptr : Pbvarray; name : PChar; nl : array [0..40] of char; i : byte; begin bnptr := @bnames; bvptr := @bvalues; DCresult := DCfunction (Dev,Port,dc_Binnames,nil,nil); if (DCresult < 0) or (DCresult >= 99) then exit; if DCresult > 0 then DCresult := DCfunction (Dev,Port,dc_Binnames,PChar(bnptr),nil); if DCresult < 0 then exit; DCresult := DCfunction (Dev,Port,dc_Bins,nil,nil); if (DCresult < 0) or (DCresult >= 99) then exit; if DCresult > 0 then DCresult := DCfunction (Dev,Port,dc_Bins,PChar(bvptr),nil); if DCresult < 0 then exit; putline ('Paper Bins :',''); if DCresult > 0 then for i := 0 to DCresult-1 do begin name := bnames [i]; if bvalues[i] > 0 then begin StrCopy (nl,' '); StrCat (nl,name); StrLCat (nl,' ',30); StrCat (nl,'= '); putinteger (nl,bvalues[i]); end; end; end; |
AW: Druckerschaechte
Vielen Dank für die schnellen und guten Antworten. Das was ich gesucht habe, habe ich im letzten Beitrag gefunden. Vielen Dank
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:39 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz