AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Fächerauswahl beim Drucker

Ein Thema von Peeters · begonnen am 3. Dez 2002 · letzter Beitrag vom 3. Dez 2002
Antwort Antwort
Peeters

Registriert seit: 3. Dez 2002
Ort: Meerbusch
86 Beiträge
 
Delphi 2007 Enterprise
 
#1

Fächerauswahl beim Drucker

  Alt 3. Dez 2002, 20:53
wie kann ich die Fächer eines Druckers ermitteln. Leider ist bei TPrinter nichts zu finden. Mir hat einer mal diesen Code geschickt nur hier funktioniert winspool nicht jeden falls bei mir nicht "unbekannt". Bei DeviceCapabilities(Device, Port, DC_BINNAMES, Nil, Nil); sagt er auch inkompatible Integer und PChar.

Delphi-Quellcode:

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;

procedure GetPrnBinNames(BinList: TStrings; WithNrInText: boolean);
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.PrinterIndex := Printer.PrinterIndex; // added
  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: unterschiedliche Anzahl und
Namen!
');
    end; // if

  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);
      BinList.Clear();
      for i:= 1 to numBinNames do begin
        temp := pBins^[i];
       if (WithNrInText)
        then BinList.AddObject( pBinNames^[i]+' '+IntToStr(temp), TObject(temp))
         else BinList.AddObject( pBinNames^[i], TObject(temp));

      end;
    finally
      FreeMem(pBinNames);
      if (pBins <> nil)
       then FreeMem(pBins);
    end;
  end; // if
end;
Ich hoffe, dass mir einer helfen kann.

Besten Dank im voraus

---
Florian Peeters
  Mit Zitat antworten Zitat
Daniel B
(Gast)

n/a Beiträge
 
#2
  Alt 3. Dez 2002, 21:04
Hallo Peeters und willkommen,

warum WinSpool nicht bekannt ist, bzw. die jeweiligen Funktionen ist, das Du die Unit "WinSpool" noch nicht eingebunden hast. Wenn ich das bei mir mache, dann sind alle Fehler weg, bis aus zwei kleinigkeiten die Du selbst wegbekommst.

Grüsse, Daniel
  Mit Zitat antworten Zitat
Peeters

Registriert seit: 3. Dez 2002
Ort: Meerbusch
86 Beiträge
 
Delphi 2007 Enterprise
 
#3
  Alt 3. Dez 2002, 21:13
Jo, habe es gerade selber festgestellt. Danke.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:31 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz