Solved

easy printer Q

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 263
Virtuailstring tree compare node issue 14 105
code issue 8 100
How to call a form that is in a DLL  from an application? 13 65
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 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

15 Experts available now in Live!

Get 1:1 Help Now