...den Drucker Name und Port auslesen?
Autor: Mad Byte
{ .... }
type
TPrinterDevice = class {type definition NOT interfaced by Printers.pas}
Driver, Device, Port: string;
end;
{ .... }
uses Printers;
{ .... }
function GetCurrentPrinterPort: string;
begin
Result := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]).Port;
end;
{The exact printer's name known to Windows for use in API calls can be obtained by:}
function GetCurrentPrinterName: string;
begin
Result := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]).Device;
end;
// Example:
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := GetCurrentPrinterPort;
Label2.Caption := GetCurrentPrinterName;
end;
printed from
www.swissdelphicenter.ch
developers knowledge base