DELPHI-如何将活动打印机设置为彩色/单色

参数TRUE时 ->将活动打印机设置为彩色

function SetPrinterColor( _b : boolean ) : boolean;
var
  buffer1 : array[0..250] of char;
  buffer2 : array[0..250] of char;
  buffer3 : array[0..250] of char;
  ADevice, ADriver, APort : pchar;
  hDm : THandle;
  pdm : PDEVMODE;
begin
  ADevice := buffer1;
  ADriver := buffer2;
  APort   := buffer3;

  { get active printer }

  Printer.GetPrinter( ADevice, ADriver, APort, hDm );

  { make change }

  Pdm := globalLock ( hDm );
  if _b then
    pdm^.dmColor := DMCOLOR_COLOR
  else
    pdm^.dmColor := DMCOLOR_MONOCHROME;
  globalUnlock(hDm);

  { set value }

  Printer.SetPrinter( ADevice, ADriver, APort, hDm );

  result := true;
end;


联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678