Click to See Complete Forum and Search --> : detecting printers


Mark Redlon
January 6th, 2003, 11:29 AM
I am trying to get a list of all the installed printers on a user's computer without using the printer dialog. I can get all the locally installed printers and I can get all available printers on the network. I want to avoid using the dialog so the user can't change print options. Any ideas?

DanM
January 7th, 2003, 03:55 AM
EnumPrinters
The EnumPrinters function enumerates available printers, print servers, domains, or print providers.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_9fjn.asp

Dan

Mark Redlon
January 9th, 2003, 02:38 PM
I am using enumprinters, however I can't seem to find only those network printers that are installed on the computer. I can detect all available printers on the network. I have no doubt there is a way to do this with enumprinters, I just haven't figuired out how yet.

DanM
January 9th, 2003, 06:22 PM
Read the documenation in more detail.
You have to set the proper flags (Ex: PRINTER_ENUM_LOCAL). Also look at the Level parameter (it affects PRINTER_ENUM_NETWORK & PRINTER_ENUM_REMOTE).

Dan

Mark Redlon
January 10th, 2003, 03:52 PM
I have used PRINTER_ENUM_LOCAL, PRINTER_ENUM_CONNECTIONS, and PRINTER_ENUM_REMOTE. With PRINTER_ENUM_REMOTE I detect all available printers on the network, not just those installed on the computer.
With PRINTER_ENUM_CONNECTIONS I don't always get the installed network printers.

Mark Redlon
January 10th, 2003, 08:30 PM
I just figured it out. A combination of PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS works. I went to the online MSDN, there was additional info not found in my version of MSDN that I got with vs6. Thanks for your response.

omi
August 1st, 2005, 03:17 AM
I need code snippet for detecting printers

Ekalavya
February 14th, 2006, 06:22 AM
I need the code too ...please post it

maruthu_lokesh
February 16th, 2007, 01:25 AM
need the code .....help me out...
hope so u can help me out....
just mail to "maruthu.lokesh@gmail.com"