Solved

easy printer Q

Posted on 2002-05-02
1
174 Views
Last Modified: 2010-04-04
Easy one: how can I list printers ??

I have a software that prints lots of documents.  I want to let the user configure some documents to get printed at a specific printer while others get printed elsewhere.

I want to let the user choose printers for jobs in a configuration panel I'm about to design.  So here is my question again:  how do I list ALL printers ?

Thanks!
0
Comment
Question by:qas
1 Comment
 
LVL 8

Accepted Solution

by:
Cesario earned 50 total points
ID: 6986371
try this

uses ..........,Pritners;

procedure TForm1.FormButton1Click(Sender: TObject);
VAR
  pcbNeeded  : DWORD;
  PcReturned : DWORD;
  Buffer     : Array[1..255] OF TPrinterInfo1;
  cnt        : Integer;
begin
  TreeView1.Items.Clear;

  EnumPrinters(
    PRINTER_ENUM_LOCAL,              // enumerates the locally installed printers
    '',
    1,                               // Use the PRINTER_INFO_1 Stucture
    @Buffer,
    SizeOf(Buffer),
    pcbNeeded,
    pcreturned
  );

  // Add the Printers to your listbox

  For Cnt := 1 to pcReturned DO
   listbox1.Items.Add ( NIL, Buffer[cnt].PName);

end;

Best Regards

Cesario
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 68
When I am typing into a TEdit last word repeats 7 145
Correct Component for Shopping Cart. 2 112
Installshield for Embarcadero EX 10.1 Berlin 4 60
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question