?
Solved

How to find all printers?

Posted on 1999-12-12
4
Medium Priority
?
805 Views
Last Modified: 2012-06-21
Hi, all!
I'm trying to enumerate all printers that are local to my computer. If I use EnumPrinters function like this :

EnumPrinters (enum_printers_local, nil, 1, ptr, buffer, needed, returned);

it returns in variable ptr (always, in my case) the last printer that was installed.
Is there a chance to see data about other printers which drivers are installed?
0
Comment
Question by:pedjasko
4 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 2275599
The other printers should be in the buffer, too. Look behind the first structure.

var i1 : integer;
    pi : PPrinterInfo1;
begin
  [...]
  pi := ptr;
  for i1 := 1 to returned do begin
    // here you can access "pi"...
    integer(pi) := integer(pi) + sizeOf(TPrinterInfo1);
  end;

Regards, Madshi.
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 150 total points
ID: 2275825
Is using Printer.printers any use to you?

Cheers,

Raymond.
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2275922
Raymond has the simplest (and consequently) the best answer. Delphi's Printer object handles all the dirty work of finding the printers mapped to the current system for you. For example:


  Listbox1.items:=Printer.Printers;

Will give you every printer mapped to your system, both locally and across the network.

0
 

Author Comment

by:pedjasko
ID: 2276252
All I need is there. Thanx!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Suggested Courses

592 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