...find the port of a named printer device (Registry)?

Author: Blitz

Category: Printing

{Dieser Code wird benötigt, um den Druckerport zum Druckername herrauszufinden.}
{You need this Code to get the Port for a Printer.}

uses registry;

function Get_Printerport(Printername: String): string;
var
  
Reg: TRegistry;
begin
  
Reg := TRegistry.Create;
  with Reg do
  begin
    
RootKey := HKEY_LOCAL_MACHINE;
     if OpenKey('\System\CurrentControlSet\Control\Print\printers\' + Printername + '\', True) then
       if 
ValueExists('port') then
       
Result := Readstring('port');
      CloseKey;
  end;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base