Autor Beitrag
Hochhaus
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 662
Erhaltene Danke: 8

Windows 7
Delphi XE2
BeitragVerfasst: Di 19.06.12 18:33 
Hallo allerseits !

ich habe ein Druckerproblem in meinem Texteditor: Wenn ich den Computer neu starte, und dann drucken will, passiert gar nichts. Sobald ich aber aus WinWord etwas gedruckt habe, funktioniert mein Proggi ohne Probleme: Es druckt !

Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
Procedure TFrmMain.MnuPrintClick(Sender: TObject);
Begin
    If DlgPrint.Execute Then
     (ActiveMDIChild As TFrmChild).PrintText;
End{* MnuPrintClick *}


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
{* Drucken *}

Procedure TFrmChild.PrintText;
Var
   Lpt: System.Text;
   I: Integer;
Begin
   AssignPrn(Lpt);
   Rewrite(Lpt);
   Try
     With Memo1 Do Begin
       Printer.Canvas.Font := Font;
       For I := 0 To Lines.Count - 1 Do
         WriteLn(Lpt, Lines[I]);
     End;
   Finally
     CloseFile(Lpt);
   End;
End{* PrintTText *}


Was läuft hier schief ?


Hochhaus


Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Di 19.06.2012 um 18:41
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 19.06.12 18:48 
Mit AssignPrn habe ich noch nie etwas gemacht. Hast du einmal probiert es normal zu machen? Also sprich direkt über das Printer-Objekt auf dessen Canvas zu schreiben, mit TextOut usw.?

Für diesen Beitrag haben gedankt: Hochhaus
Hochhaus Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 662
Erhaltene Danke: 8

Windows 7
Delphi XE2
BeitragVerfasst: Di 19.06.12 18:51 
Moderiert von user profile iconNarses: Komplett-Zitat des letzten Beitrags entfernt.

Ja, das habe ich in einem anderen Projekt getan: Das Problem ist dasselbe ! Ich vermute, dass es mit dem Druckertreiber unter Windows 7 zu tun hat .. aber ich weiss es nicht.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Di 19.06.12 20:44 
Dein Code funktioniert bei mir ohne Probleme WIN7 >> PDF24
Hast Du mal versuchsweise einen PrintDialog vorher aufgerufen?

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS

Für diesen Beitrag haben gedankt: Hochhaus
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 19.06.12 21:11 
Siehe der erste Codeabschnitt, danach wird das Drucken ja erst gestartet. ;-)

Jedenfalls würde ich mal sagen, dass das an deinem Drucker bzw. genauer gesagt dessen Treiber liegt. Wer weiß was Word da noch initialisiert. :nixweiss: Aber nötig hätte das eigentlich bei keinem Drucker sein dürfen...

Für diesen Beitrag haben gedankt: Hochhaus
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Di 19.06.12 23:00 
@jaenicke
Danke ... blind :autsch:

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Hochhaus Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 662
Erhaltene Danke: 8

Windows 7
Delphi XE2
BeitragVerfasst: Mi 20.06.12 08:07 
user profile iconjaenicke hat folgendes geschrieben Zum zitierten Posting springen:


Jedenfalls würde ich mal sagen, dass das an deinem Drucker bzw. genauer gesagt dessen Treiber liegt. Wer weiß was Word da noch initialisiert. :nixweiss: Aber nötig hätte das eigentlich bei keinem Drucker sein dürfen...


Ich denke auch, dass es am Druckertreiber liegt. Anderswo funktioniert es problemlos ...