I'm translating an old code where I was printing directly to the communication port, LPTs and COMs. At first I was using writePrinter and it worked, but at one point I needed to get a return from the printer and was told that readPrinter can not get that return. So I started using Assingfile.
var print : textfile ; teste12 : Ansistring; begin teste := #16 + #04 + #2; Assignfile (print, 'COM4'); // = PORTA DE COMUNICACAO rewrite(print); writeLn(print, teste); closefile(print); //fecha o arquivo end;
The problems are three:
1-I do not want the user to tell the printer port. With whitePrinter I used a library of "printers" and for this I was able to get the printer driver and direct,in this case I do not know how to get the door.
Obs: The solution can not be searches in windows records ... not to get stuck in an architecture.
I saw something about AssignPrn, but it looks like this only prints to the default printer, is that right?
2-In this code example the printer should receive, in hex, "10 04 02" but receive "" 10 04 02 0D 0A "which I believe to be the characters indicating the end of the string. How do I solve it?
3-Even if the two above problems are solved ... I do not know how to get the return printer.