Board index » delphi » Getting a list of windows printers.

Getting a list of windows printers.

I want to get a list of windows printers in a listbox, how can i do that?

Regards,

Ben van Erp

 

Re:Getting a list of windows printers.


Quote
Ben van Erp wrote in message <7enerv$fu...@news.worldonline.nl>...
>I want to get a list of windows printers in a listbox, how can i do that?

>Regards,

>Ben van Erp

Include printers in your uses statement. This sets up a global object
"printer" of type TPrinter

The list of windows printers (which is actually from the windows API) is a
list of type TStrings (just like a list box) called "printer.printers.names"

So all you need do is something like this

assuming:           var printerlist : TListBox;
                                   I: integer;

then
                       for i := 0 to pinter.printers.count-1 do
printerlist.add(printer.printers.names[i]);

Glen.

Other Threads