Mega Code Archive

 
Categories / Delphi / Printing
 

Find the port of a named printer device [registry]

{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;