daniel....@gmail.com
unread,May 15, 2015, 5:44:11 PM5/15/15You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Good evening,
I am developing a kiosk application. In that application i need to send some commands to a printer with ESC/POS protocol.
I have some commands that give me information about printer (printer status, end of paper status). For sending command I use this function:
type
TPrnBuffRec = record
bufflength: Word;
Buff_1: array[0..255] of Char;
end;
function DirectToPrinter(S: string; NextLine: Boolean): Boolean;
var
Buff: TPrnBuffRec;
TestInt: Integer;
begin
TestInt := PassThrough;
if Escape(Printer.Handle, QUERYESCSUPPORT, SizeOf(TESTINT), @testint, nil) > 0 then
begin
if NextLine then S := S + #13 + #10;
StrPCopy(Buff.Buff_1, S);
Buff.bufflength := StrLen(Buff.Buff_1);
Escape(Printer.Canvas.Handle, Passthrough, 0, @buff, nil);
Result := True;
end
else
Result := False;
end;
but I need also to read the printer reply so i updated the function:
type
TPrnBuffRec = record
bufflength: Word;
Buff_1: array[0..255] of Char;
end;
function DirectToPrinter(S: string; NextLine: Boolean): Boolean;
var
Buff: TPrnBuffRec;
Risposta: TPrnBuffRec;
TestInt: Integer;
begin
TestInt := PassThrough;
if Escape(Printer.Handle, QUERYESCSUPPORT, SizeOf(TESTINT), @testint, nil) > 0 then
begin
if NextLine then S := S + #13 + #10;
StrPCopy(Buff.Buff_1, S);
Buff.bufflength := StrLen(Buff.Buff_1);
Escape(Printer.Canvas.Handle, Passthrough, 0, @buff, @Risposta.Data);
Result := True;
end
else
Result := False;
end;
and what i read from Risposta is not what i'm waiting for.
I'm developing on delphi xe2.
Could someone help me?
Thanks