Ver Mensaje Individual
  #1  
Antiguo 02-12-2005
jmlifi jmlifi is offline
Miembro
 
Registrado: abr 2005
Posts: 188
Reputación: 20
jmlifi Va por buen camino
Error imprimiendo: "printing in progress"

Código Delphi [-]
 tengo el siguiente codigo:

procedure ActivaImpresora(const s: string);
var
   Device, Name, Port : array[0..100] of char;
   DevMode            : THandle;
begin
 with printer do begin
     if s<>'' then begin
        PrinterIndex :=printers.IndexOf(s);
     end
     else
        PrinterIndex := -1;
     GetPrinter(Device, Name, Port, DevMode);
     SetPrinter(Device, Name, Port, 0);
   end;
end;
 
----------------------------------------------------------------------------------------------
procedure TPiezasFrm.EtiquetaBtnClick(Sender: TObject);
var Prn   : TPrn;
    t : integer;
begin
    t:= 1;
    uno:= 2;
    dos:= 4;
    tres:= 5;
    cuatro:= 6;
    cinco:= 7;
    par:= false;
    VerConjuntos.Close;
    VerConjuntos.ParamByName('codigo').AsString := PiezasREF_N.AsString;
    VerConjuntos.ParamByName('c_vr').AsString := PiezasVRSION.AsString;
    VerConjuntos.Open;
      //if Verconjuntos.IsEmpty then
      //imprimeetiquetas(0);
    If not VerConjuntos.IsEmpty then begin
       ActivaImpresora(Principal.PrnEtiqueta);
       Prn.Init(Printer.Canvas,'Arial',10,true);
       Prn.EscalaSep(1,1.0);
       Printer.Orientation  := poPortrait;
       Printer.BeginDoc;
 
          VerConjuntos.first;
          while t<=8 do begin
             while not VerConjuntos.Eof do begin
               if (t>1) and (par=false) then begin
                  uno:=uno+7;
                  dos:=dos+7;
                  tres:=tres+7;
                  cuatro:=cuatro+7;
                  cinco:=cinco+7;
               end;
               ImprimeUnaEtiqueta(Prn,VerConjuntosCANT.AsInteger);
               if par=false then begin
                  par:=true;
                  VerConjuntos.Next;
               end
               else begin
                  par:=false;
                  VerConjuntos.Next;
                  break;
               end;
 
             end;
              inc(t);
           end;
        ActivaImpresora('')
      end;
end;

ActivaImpresora(Principal.PrnEtiqueta) no tengo problemas, pero todavía no me llega a imprimir
ActivaImpresora('') PrinterIndex coge valor -1 y me salta el error "printing in progress". si comento esta parte, la impresosa me marca 1 documento ha imprimir pero no me imprime nada. Cuando cierro la aplicacion es cuando imprime.

Última edición por vtdeleon fecha: 02-12-2005 a las 16:08:21.
Responder Con Cita