Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Impresión (https://www.clubdelphi.com/foros/forumdisplay.php?f=4)
-   -   Elección de la bandeja de impresión (https://www.clubdelphi.com/foros/showthread.php?t=43530)

sur-se 14-05-2007 14:11:24

Elección de la bandeja de impresión
 
Hola.
Con el código siguiente puedo elegir la bandeja de impresión:
Código:


          with Printer do
          begin
                Getprinter(ADevice, ADriver, APort, ADeviceMode);
                DevMode := GlobalLock(ADeviceMode);
                // Le indicamos la bandeja por la que queremos sacar el informe.
                DevMode.dmDefaultSource := <Bandeja>;
          end;

El problema está en como saber que número de le corresponde a cada una de las bandejas de cada impresora. El código siguiente me dice que bandejas tiene la impresora actualmente seleccionada, pero no sé a que valor debo asignar a la propiedad anteriormente indicada (dmDefaultSource). Incluso he probado a hacer múltiples pruebas con números y no he conseguido encontrar la que le corresponde, imprimiendo la impresora por donde quiere.

Código:

procedure TMainForm.GetBinNames;
var
  BinNames: Pointer;
  i: integer;
begin
{$R-} // Range checking must be turned off here.
  // First determine how many bin names are available.
  Rslt := DeviceCapabilitiesA(Device, Port, DC_BINNAMES, nil, nil);
  if Rslt > 0 then
  begin
    { Each bin name is 24 bytes long. Therefore, allocate Rslt*24 bytes to hold
      the bin names. }
    GetMem(BinNames, Rslt*24);
    try
      // Now retrieve the bin names in the allocated block of memory.
      if DeviceCapabilitiesA(Device, Port, DC_BINNAMES, BinNames, nil) = -1 then
        raise Exception.Create('DevCap Error');
      //{ Add the information to the appropriate list box.
      AddListViewItem('BIN NAMES', EmptyStr, lvGeneralData);
      for i := 0 to Rslt - 1 do
      begin
        AddListViewItem(Format('  Bin Name %d', [i]),
          StrPas(TBinNames(BinNames^)[i]), lvGeneralData);
      end;
    finally
      FreeMem(BinNames, Rslt*24);
    end;
  end;
{$R+} // Turn range checking back on.
end;

¿Alguien sabe como determinar la correspondencia entre una y otra?
Un saludo.


La franja horaria es GMT +2. Ahora son las 09:40:40.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi