- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Getting bin names from your printer

Question:

How do I retrieve the bin names of all bins for a particular printer using DeviceCapabilities?

Answer:

Here's a very simple app to do this. Just start a brand new

project in Delphi and drop down a TButton and a TMemo. Then 

double click the button and paste this code snippet over the 

corresponding code in the implementation of Unit1.



uses

  WinSpool;



const

  PName = 'DELPHI III';

  PPort = '\\CONAN\DELPHI_III';



procedure TForm1.Button1Click(Sender: TObject);

var

  i : Integer;

  p : PChar;

begin

  GetMem(p,24*DeviceCapabilities(PName,PPort,DC_BINNAMES,nil,nil));

  with Memo1, Lines do begin

    Clear;

    for i:=1 to DeviceCapabilities(PName,PPort,DC_BINNAMES,p,nil) do

      Add(p+24*(i-1));

  end;

  FreeMem(p);

end;




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile