hgiacobone
15-06-2017, 20:40:25
Hola. Aqui llego con un tema algo raro.
Hemos mudado el codigo del viejo Delphi-7 hacia un Delphi-XE4 y, entre otras, la funcion de impresion sobre impresoras Zebra no ha funcionado nunca más.
Digamos, no produce ninguna salida. Aqui parte del código que es "standard" en varios foros:
function Write_RAW_StringToPrinter(PrinterName:String; comando:String): Boolean;
var
PrinterHandle: THandle;
N: DWORD;
DocInfo1: TDocInfo1;
begin
if not WinSpool.OpenPrinter(PChar( PrinterName ), PrinterHandle, nil)
then raise exception.create(PrinterName+#13+'OpenPrinter error ' + IntToStr(GetLastError));
Try
with DocInfo1 do
begin
pDocName := PChar('Keuken Doc');
pOutputFile := nil;
pDataType := 'RAW';
end;
if StartDocPrinter(PrinterHandle, 1, @DocInfo1) <> 0 then
begin
StartPagePrinter(PrinterHandle) ;
////// EN ESTE PUNTO PARECE NO REALIZAR NADA, NI TAMPOCO DA ERROR ///////////
WritePrinter(PrinterHandle, PChar(comando) , Length( PChar(comando) ), N);
end;
Lo mismo en Delphi-7 anda perfecto.
Lo mismo en XE4, compilado en 32 bits o en 64bits no anda...:(
¿Alguna idea o sugerencia con esto?:confused:
Hemos mudado el codigo del viejo Delphi-7 hacia un Delphi-XE4 y, entre otras, la funcion de impresion sobre impresoras Zebra no ha funcionado nunca más.
Digamos, no produce ninguna salida. Aqui parte del código que es "standard" en varios foros:
function Write_RAW_StringToPrinter(PrinterName:String; comando:String): Boolean;
var
PrinterHandle: THandle;
N: DWORD;
DocInfo1: TDocInfo1;
begin
if not WinSpool.OpenPrinter(PChar( PrinterName ), PrinterHandle, nil)
then raise exception.create(PrinterName+#13+'OpenPrinter error ' + IntToStr(GetLastError));
Try
with DocInfo1 do
begin
pDocName := PChar('Keuken Doc');
pOutputFile := nil;
pDataType := 'RAW';
end;
if StartDocPrinter(PrinterHandle, 1, @DocInfo1) <> 0 then
begin
StartPagePrinter(PrinterHandle) ;
////// EN ESTE PUNTO PARECE NO REALIZAR NADA, NI TAMPOCO DA ERROR ///////////
WritePrinter(PrinterHandle, PChar(comando) , Length( PChar(comando) ), N);
end;
Lo mismo en Delphi-7 anda perfecto.
Lo mismo en XE4, compilado en 32 bits o en 64bits no anda...:(
¿Alguna idea o sugerencia con esto?:confused: