Mega Code Archive

 
Categories / Delphi / Printing
 

Check, if the current printer prints in color

Title: check, if the current printer prints in color? 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;