Solved

easy printer Q

Posted on 2002-05-02
1
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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