Autor Beitrag
Dusty
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 62

Windows XP
Delphi 5 Enterprise
BeitragVerfasst: Mi 08.04.09 15:19 
Weiß jemand warum ein Netzwerk Drucker, der in Printer.Printers gelistet ist, bei meinem Delphi Programm bei dem Befehl Printer.BeginDoc die Meldung ausgibt

"... ist eine Exception der Klasse EPrinter aufgetreten. Meldung: 'Ausgewählter Drucker ist ungültig:"?

Printer.Printers[n] ist:
\\192.168.0.102\HP Color LaserJet 1600

Alle anderen Windowsprogramme kommen damit klar - meins soll auch damit klarkommen :?!?:
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 08.04.09 18:58 
Welcher Drucker ist denn ausgewählt, wenn du BeginDoc aufrufst? Ob er irgendwo in Printers drinsteht ist ja irrelevant, die Frage ist ja welcher davon ausgewählt ist (PrinterIndex glaube ich).
Dusty Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 62

Windows XP
Delphi 5 Enterprise
BeitragVerfasst: Do 09.04.09 09:14 
Alle Drucker sind in einer ComboBox aufgelistet und der User wählt dann denn Drucker aus.

Die Zuweisung des Druckers erfolgt sinngemäss so:
ausblenden Delphi-Quelltext
1:
Printer.PrinterIndex := Printer.Printers.IndexOf(selectedprinter);  // Hier wird noch nicht gemeckert!					

Erst bei Printer.BeginDoc kommt die Exception.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 09.04.09 12:27 
Moin!

Lass dir doch mal testweise ausgeben, was du da zugewiesen hast: :idea:
ausblenden Delphi-Quelltext
1:
2:
Printer.PrinterIndex := Printer.Printers.IndexOf(selectedprinter);  // Hier wird noch nicht gemeckert!
ShowMessage(IntToStr(Printer.PrinterIndex)); // sollte >= 0 sein
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.