Ver Mensaje Individual
  #2  
Antiguo 28-04-2005
Avatar de marcoszorrilla
marcoszorrilla marcoszorrilla is offline
Capo
 
Registrado: may 2003
Ubicación: Cantabria - España
Posts: 11.221
Reputación: 10
marcoszorrilla Va por buen camino
Yo guardo la impresora elegida por el usuario en una tabla, de hecho guardo, impresora para facturas, para listados, y alguna cosa más y luego a la hora de imprimir ya tengo en la tabla el nombre de la impresora con la que voy a imprimir.

Utilizo esta función:
Código Delphi [-]
   Function GetImpresora(Impre:String):Integer;
   Var
   nCont:Integer;
   lSearch:Boolean;
   cNewLIne:String;
   begin
   lSearch:=False;
   cNewLine:=Chr(10)+Chr(13);
   
     For nCont:=0 to Printer.Printers.Count - 1 do
     //buscamos la impresora en la lista del sistema
     begin
   
       if Pos(impre, Printer.Printers[nCont]) <> 0 then
       begin
       lSearch:=True;
       Result:=nCont;
       Break;
       end;
   
     end;
   
     if lSearch = False then
     begin
     Result:=-1;
     ShowMessage('Impresora no encontrada:'+
  cNewLine+Impre+cNewLine+'Se utilizará la predefinida.');
     end;
   
   procedure TfrDescuadresTodosProv.spListadoVistaClick(Sender: TObject);
   begin
   Application.CreateForm(TfrLstDescuadres, frLstDescuadres);
   frLstDescuadres.ListaDescuadres.PrinterSettings.PrinterIndex:=
 GetImpresora(DmAni2.ConfLptListados.value);
   frLstDescuadres.ListaDescuadres.PreviewModal;
   frLstDescuadres.Close;
   end;

Un Saludo.
__________________
Guía de Estilo de los Foros
Cita:
- Ça c'est la caisse. Le mouton que tu veux est dedans.
Responder Con Cita