...implement the printto command?

Author: P. Below
Homepage: http://www.teamb.com

Category: Printing

uses
  
Printers, Shellapi;

procedure TForm1.Button1Click(Sender: TObject);
var
  
Device: array[0..255] of Char;
  Driver: array[0..255] of Char;
  Port: array[0..255] of Char;
  S: string;
  hDeviceMode: THandle;
  documentname: string;
begin
  
Printer.PrinterIndex := -1;  // select a printer, in this case default
  
Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
  S := Format('"%s" "%s" "%s"', [Device, Driver, Port]);
  documentname := 'c:\anydocument.doc';
  ShellExecute(Handle, 'printto', PChar(documentname), PChar(S), nil, SW_HIDE);
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base