[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

easy printer Q

Posted on 2002-05-02
1
Medium Priority
?
180 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

834 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