Problem sending Control Codes To Printer In Delphi 4 
Author Message
 Problem sending Control Codes To Printer In Delphi 4

This is the program sent to me by Epson to demonstrate the codes used to
open the cash drawer from an Epson TMU200D receipt printer. This program
works and does open the drawer.

cls
print "EPSON TEST PROGRAM FOR CASH DRAWER"
LPRINT "THIS IS AN EPROM TEST"
LPRINT "OPENS THE CASH DRAWER"
LPRINT " "
LPRINT
CHR$(27)+CHR$(112)+CHR$(0)+CHR$(25)+CHR$(250)+CHR$(27)+CHR$(67)+CHR$(52)+CHR
$(0)+CHR$(27)+CHR$(117)+CHR$(0)
CLOSE
STOP

This is the code in Delphi4. It goes to the printer but instead of opening
the cash drawer, it prints the characters on the paper.

procedure TfrmNewPay.OpenCashDrawer;
var
  f : TextFile;
begin
  Printer.PrinterIndex := frmSales.iCashDrawer;
  if (frmSales.sCashDrawerString = '') or (frmSales.iCashDrawer = -1) then
Exit;
  AssignFile(f, 'temp.txt');
  AssignPrn(f);
  Rewrite(f);
  Writeln(f,
chr(27)+chr(112)+chr(0)+chr(25)+chr(250)+chr(27)+chr(67)+chr(52)+chr(0)+chr(
27)+chr(117)+chr(0));
  CloseFile(f);

end;

Please help me. How do you send control codes in delphi 4 to the printer and
have them treated as control codes.

Lew Blackman
Poscomp International Inc.




Wed, 18 Jun 1902 08:00:00 GMT  
 Problem sending Control Codes To Printer In Delphi 4

Quote:
> This is the code in Delphi4. It goes to the printer but instead of opening
> the cash drawer, it prints the characters on the paper.
[snap]
> Please help me. How do you send control codes in Delphi 4 to the printer and
> have them treated as control codes.

Try using the WinAPI procedure ExtEscape.

Bye, Udo



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem sending Control Codes To Printer In Delphi 4



Quote:
> This is the program sent to me by Epson to demonstrate the codes used to
> open the cash drawer from an Epson TMU200D receipt printer. This program
> works and does open the drawer.

> cls
> print "EPSON TEST PROGRAM FOR CASH DRAWER"
> LPRINT "THIS IS AN EPROM TEST"
> LPRINT "OPENS THE CASH DRAWER"
> LPRINT " "
> LPRINT

CHR$(27)+CHR$(112)+CHR$(0)+CHR$(25)+CHR$(250)+CHR$(27)+CHR$(67)+CHR$(52)+CHR
Quote:
> $(0)+CHR$(27)+CHR$(117)+CHR$(0)
> CLOSE
> STOP

> This is the code in Delphi4. It goes to the printer but instead of opening
> the cash drawer, it prints the characters on the paper.

> procedure TfrmNewPay.OpenCashDrawer;
> var
>   f : TextFile;
> begin
>   Printer.PrinterIndex := frmSales.iCashDrawer;
>   if (frmSales.sCashDrawerString = '') or (frmSales.iCashDrawer = -1) then
> Exit;
>   AssignFile(f, 'temp.txt');
>   AssignPrn(f);
>   Rewrite(f);
>   Writeln(f,

chr(27)+chr(112)+chr(0)+chr(25)+chr(250)+chr(27)+chr(67)+chr(52)+chr(0)+chr(

Quote:
> 27)+chr(117)+chr(0));

try this
Writeln(f,#27#112#0#25#250#27#67#52#0#27#117#0);

Quote:
>   CloseFile(f);

> end;

> Please help me. How do you send control codes in Delphi 4 to the printer
and
> have them treated as control codes.

--
Truly yours
Serg V. Chernetchenko


Wed, 18 Jun 1902 08:00:00 GMT  
 Problem sending Control Codes To Printer In Delphi 4

Quote:

> cls
> print "EPSON TEST program FOR CASH DRAWER"
> LPRINT "THIS IS AN EPROM TEST"
> LPRINT "OPENS THE CASH DRAWER"
> LPRINT " "
> LPRINT
> CHR$(27)+CHR$(112)+CHR$(0)+CHR$(25)+CHR$(250)+CHR$(27)+CHR$(67)+CHR$(52)+CHR
> $(0)+CHR$(27)+CHR$(117)+CHR$(0)
> CLOSE
> STOP

> Please help me. How do you send control codes in Delphi 4 to the printer and
> have them treated as control codes.

If you want to do the same as the Basic code above, then it will
be something like this:

procedure TfrmNewPay.OpenCashDrawer;
var
  f : TextFile;
begin
  if (frmSales.sCashDrawerString = '') or (frmSales.iCashDrawer = -1)
  then Exit;
  AssignFile(f, 'LPT1');
  Rewrite(f);
  Writeln(f,
  chr(27)+chr(112)+chr(0)+chr(25)+chr(250)+chr(27)+chr(67)+chr(52)+chr(0)+chr(
  27)+chr(117)+chr(0));
  CloseFile(f);

With that example the printing is done in the old DOS style, and all
the Esc-commands will go to the printer. But you can't use anything
related to Windows Printing System. So Printer.PrinterIndex to select
the printer etc. are useless.

As someone suggested, PassThrough printing, using WINAPI Escape
(ExtEscape) function is another way to make Esc sequences to go
through to the printer.

Markku Nevalainen



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. BARCODE and send CONTROL CHARACTERS to my printer by DELPHI or Pascal Language

2. cant send asci codes to printer

3. Control codes for hp 600c printer?

4. Esc codes for my printer=for all printer?

5. Send the output screen to the printer, Turbo Pascal for Windows

6. Sending Line Feed to Printer

7. closing a data stream sent to the printer...

8. How to send ESC commands to printer

9. Sending coordinates to a Printer - Please HELP!

10. Sending a text file to a printer?

11. How do send output to printer

12. Send control character to Comms port

 

 
Powered by phpBB® Forum Software