Solved

easy printer Q

Posted on 2002-05-02
1
171 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now