This sample shows a very simple console program that displays some information about the local printers installed on the local system. For this, it uses the EnumPrinters() API in level 2, which returns the printers information in a PRINTER_INFO_2 structure array. Some of the information contained therein is:
Server name
Printer name
Share name (if Applicable)
Ports the printer is connected to
Driver name
Comment and location provided by the admin
Under Win9x, it says if the printer is the default printer for the system
So, without anything else, here it is: enumprint.c