Ver Mensaje Individual
  #2  
Antiguo 05-05-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
Pon un memo y mira este código:

Código Delphi [-]
 unit Tipospapel;
 
 interface
 
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
   StdCtrls,WinSpool,Printers;
   procedure GetPapernames(sl: TStrings);
 type
   TForm1 = class(TForm)
     Button1: TButton;
     Memo1: TMemo;
     procedure Button1Click(Sender: TObject);
   private
     { Private declarations }
   public
     { Public declarations }
   end;
 
 var
   Form1: TForm1;
 
 implementation
 
 {$R *.DFM}
 
 procedure TForm1.Button1Click(Sender: TObject);
 begin
  GetPapernames(memo1.Lines);
 end;
 
 procedure GetPapernames(sl: TStrings);
 type
   TPaperName      = array [0..63] of Char; 
   TPaperNameArray = array [1..High(Word) div SizeOf(TPaperName)] of TPaperName; 
   PPapernameArray = ^TPaperNameArray; 
 var 
   Device, Driver, Port: array [0..255] of Char; 
   hDevMode: THandle; 
   i, numPaperformats: Integer; 
   pPaperFormats: PPapernameArray; 
 begin 
   Printer.PrinterIndex := -1; // Standard printer 
   Printer.GetPrinter(Device, Driver, Port, hDevmode); 
   numPaperformats := WinSpool.DeviceCapabilities(Device, Port, DC_PAPERNAMES, nil, nil); 
   if numPaperformats <> 0 then  
   begin 
     GetMem(pPaperformats, numPaperformats * SizeOf(TPapername)); 
     try 
       WinSpool.DeviceCapabilities(Device, Port, DC_PAPERNAMES, 
         PChar(pPaperFormats), nil); 
       sl.Clear; 
       for i := 1 to numPaperformats do sl.Add(pPaperformats^[i]); 
     finally 
       FreeMem(pPaperformats); 
     end; 
   end; 
 end; 
 
 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