Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sending Escape Characters to Printers for Opening Cash Drawers

401 views
Skip to first unread message

Lefteris Georgiou

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
Hi,

Can anybody send me a little procedure that sends the following escape
characters to an EPSON printer that is connected to a cash drawer:

ASCII : ESC p m t1 t2
Decimal: 27 112 0 20 80

m = 0 for the 1st drawer
m = 1 for the 2nd drawer

Thanks in advance

Fnugry Yo

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to

Use Escape or ExtEscape API with escape code set to PASSTHROUGH and input buffer filled with your escape sequence.

Aleko Boychev

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
Yeah :))
If you wish, I can give you a sample driver for OPOS printer :)))
Or not :)
Ok, the main idea is that you should use writefile and readfile to
communicate with the COM ports.
Whatever, Microsoft is providing Printer.ocx, scanner.ocx, cashdrawer.ocx
and msr.ocx.
You should use the sequences like Printer1.Open(); Printer1.Claim(2000);
Printer1.Close.
The driver should send the escape sequence using the WriteFile with the
handle to the device :)

Best:
Al
Lefteris Georgiou <lefteris...@skynet.be> wrote in message
news:8nbcb0$sr...@bornews.borland.com...

Paul Baker

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
I would use OpenPrinter, StartDocPrinter and EndDocPrinter rather than
CreateFile.

Paul :)

"Aleko Boychev" <al...@numberonemm.com> wrote in message
news:399937ad_2@dnews...

Peter Below (TeamB)

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
In article <8nbcb0$sr...@bornews.borland.com>, Lefteris Georgiou wrote:
> Can anybody send me a little procedure that sends the following escape
> characters to an EPSON printer that is connected to a cash drawer:
>
> ASCII : ESC p m t1 t2
> Decimal: 27 112 0 20 80
>
> m = 0 for the 1st drawer
> m = 1 for the 2nd drawer

PrintLineToGeneric( #27#112#0#20#80 );

where


Uses WinSpool;

Const
GenericPrinter: Pchar = 'Universal/Nur Text';
// Change to systems generic drivers name or Epson printer name

Procedure PrintLineToGeneric(Const line: string );
Var
BytesWritten: DWORD;
hPrinter: THandle;
DocInfo: TDocInfo1;
Begin
If not WinSpool.OpenPrinter(GenericPrinter, hPrinter, nil) Then
raise exception.create('Printer not found');

Try
DocInfo.pDocName := 'MyDocument';
DocInfo.pOutputFile := Nil;
DocInfo.pDatatype := 'RAW';
If StartDocPrinter(hPrinter, 1, @DocInfo) = 0 Then
Abort;

Try
If not StartPagePrinter(hPrinter) Then
Abort;
try
If not WritePrinter(hPrinter, @line[1], Length(line), BytesWritten)
Then
Abort;
Finally
EndPagePrinter(hPrinter);
End;
Finally
EndDocPrinter(hPrinter);
End;
Finally
WinSpool.ClosePrinter(hPrinter);
End;
End;

Peter Below (TeamB) 10011...@compuserve.com)
No replies in private e-mail, please, unless explicitly requested!


0 new messages