AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

LAN - Drucker

Ein Thema von neXus111 · begonnen am 26. Jun 2007 · letzter Beitrag vom 1. Jul 2007
 
hathor
(Gast)

n/a Beiträge
 
#4

Re: LAN - Drucker

  Alt 1. Jul 2007, 16:54
Delphi-Quellcode:

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
     Dialogs, Printers, StdCtrls, Registry, WinSpool; // einiges kann man entfernen...

Function Get_Printerport(Printername: string): string;
var
  Reg: TRegistry;
  p: Integer;
begin
  Reg := TRegistry.Create;
  with Reg do
  begin
    RootKey := HKEY_CURRENT_USER;
    if OpenKey('\Software\Microsoft\Windows NT\CurrentVersion\Devices\', True) then
    begin
      if ValueExists(Printername) then
      begin // The reg Key value may look like "winspool,LPT1:"
        Result := ReadString(Printername);
        p := Pos(',', Result);
        Result := Copy(Result, p + 1,Length(Result) - p);
      end;
    end;
    CloseKey;
  end;
end;

procedure TForm1.FormShow(Sender: TObject);
var i:integer;
begin
Memo1.Clear;
ListBox1.Items := Printer.Printers;

for i := 0 to ListBox1.Count - 1 do
begin
   Memo1.Lines.Add(ListBox1.Items.Strings[i]+' : '+ Get_Printerport(ListBox1.Items.Strings[i]));
end;
//Memo1.Lines.Add('Active printer is : '+ Printer.Printers[Printer.PrinterIndex]);
//Memo1.Lines.Add('Port : '+ Get_Printerport(Printer.Printers[Printer.PrinterIndex]));
end;
Beispiele:

Memo1:

ScanSoft PDF Create! : Ne00:
Samsung CLP-510N(TCP) : Ne01:
Panasonic KX-P8415-LPT1 : LPT1:
Panasonic KX-P8415 (USB) : Ne02:
Panasonic KX-P8415 (LPT1) : LPT1:
Panasonic KX-P8415 (AXIS-200) : Ne03:
P-COLOR-AXIS-200 : Ne04:
Microsoft Office Document Image Writer : Ne05:
FreePDF XP : Ne06:
FinePrint : FPR5:
\\http://192.168.1.201\CLP-510N : Ne07:
Active printer is : \\http://192.168.1.201\CLP-510N
Port : Ne07:
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:12 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz