Autor Beitrag
Nather
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Do 29.08.02 20:44 
Hallo,

weiss jemand wie man unter W2k, XP ermitteln kann ob der ausgewählte Drucker ein Farbdrucker ist.
knightkiller
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

WinXP SP2
D7 Pers, D2005 Pers
BeitragVerfasst: Do 05.09.02 10:16 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
uses 
  Printers, WinSpool; 

procedure TForm1.Button1Click(Sender: TObject); 
var 
  Dev, Drv, Prt: array[0..255] of Char; 
  DM1: PDeviceMode; 
  DM2: PDeviceMode; 
  Sz: Integer; 
  DevM: THandle; 
begin 
  Printer.PrinterIndex := -1; 
  Printer.GetPrinter(Dev, Drv, Prt, DevM); 
  DM1 := nil; 
  DM2 := nil; 
  Sz  := DocumentProperties(0, 0, Dev, DM1^, DM2^, 0); 
  GetMem(DM1, Sz); 
  DocumentProperties(0, 0, Dev, DM1^, DM2^, DM_OUT_BUFFER); 
  if DM1^.dmColor > 1 then 
    label1.Caption := Dev + ': Color' 
  else 
    label1.Caption := Dev + ': Black and White'; 
  if DM1^.dmFields and DM_Color <> 0 then 
    Label2.Caption := 'Printer supports color printing' 
  else 
    Label2.Caption := 'Printer does not support color printing'; 
  FreeMem(DM1); 
end;


gruss knightkiller
Nather Threadstarter
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Do 05.09.02 19:55 
Hallo,

danke für die Antwort. Leider erhalte ich bei einigen SW-Druckern die Meldung, dass es sich um Farb-Drucker handelt.

mfg
Nather
OregonGhost
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 215



BeitragVerfasst: Fr 06.09.02 10:34 
Ich kann dir zwar nicht weiterhelfen, aber ich würde dmColor nicht mit 1 oder 2 vergleichen, sondern mit den Konstanten DMCOLOR_COLOR und DMCOLOR_MONOCHROME. Hat zwar mehr mit Stil zu tun, aber erhöht auch die Lesbarkeit (und Zukunftssicherheit) des Codes.

_________________
Oregon Ghost
---
Wenn NULL besonders groß ist, ist es fast schon wie ein bisschen eins.
knightkiller
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

WinXP SP2
D7 Pers, D2005 Pers
BeitragVerfasst: Mo 09.09.02 08:46 
Der Code stammt nicht von mir, sondern von [url]www.swissdelphicenter.ch[/url] 8)